In htop, there is a color coding for the individual section, so let’s have a look at what each color indicates while using htop.
Now, let’s jump to the actual implementation part.
As the htop is mainly used to check for system resources, let’s have a look at how you can sort the processes based on resource consumption.
The easiest way to sort processes based on CPU and memory usage is to use your mouse pointer. Hover the cursor over the CPU or Memory section and click on any of those.
And there you will see an icon of a triangle △ and based on that you can sort the process based on highest to lowest resource consumption:
But if you are dealing with remote servers, you might not have the privilege to use a mouse and in those cases, you can use keyboard shortcuts.
Press F6 and it will bring up every option available to sort the ongoing processes:
You can use arrow keys to select a preferred sorting option and then press the Enter key, results should reflect as intended.
If you want to look for a specific process and its resource consumption, you can press F3 and it will get you a search prompt as shown below:
For example, I searched for htop, and it highlighted the process with light orange color. And you can press F3 for the next result.
While searching may get you the intended results, I find the filtering process using keywords even more effective as it presents a list of processes.
To filter processes, you have to press F4 and type the name of the process. For example, I filtered processes related to gnome-boxes:
Once you made it to find the most resource-hungry and unnecessary process, you just have to press F9, and it will present you with termination signals:
I can’t cover all 15 termination signals, we have a separate guide on different termination signals, so you can refer to that guide if you intend to learn more about them.
But I will recommend you use SIGTERM first, as it is the most efficient and friendly way to kill the process.
Here, my aim is to add a date and time and change the color scheme to monochrome.
First, press F2, and it will being setup prompt allowing users to change how htop looks:
First, hover to the Colors sections and press Enter and it will allow us to change the color scheme. From there, select the Monochrome option and press Enter to save changes:
Now, go back to the setup option, and from there, use the left arrow key to explore available meters:
As I intend to add the Date and time, I have to press Enter once I find the option for it.
Here, it will allow you to place the date and time in any of the left and right columns and you can use the up and down arrow keys to change the order of columns.
So I placed the date and time meter with the last styling option (you can change styles using the spacebar):
Once you are done aligning the date and time meter, press the enter key to save changes and F10 to close the setup prompt.
htop is good. But there are other similar tools that might be better than it. Check them out if you want to.
In this guide, I explained how you can install the htop utility in different Linux distributions and how you can use some basic functionalities of htop to manage system resources efficiently.
But htop can do a lot more and for that and to learn more, you can always refer to its man page, and we have a detailed guide on how you can get the most out of the man page in Linux.
This article is the continuation of our Linux system monitoring series, today we’re talking about the most popular monitoring tool called htop, which is just reached version 3.0.5 and comes with some cool new features.
Htop is an interactive real-time process monitoring application for Linux/Unix-like systems and also a handy alternative to top command, which is a default process monitoring tool that comes pre-installed on all Linux operating systems.
Htop has numerous other user-friendly features, which are not available under the top command and they are:
The htop packages are mostly available in all modern Linux distributions and can be installed using the default package manager from your system.
$ sudo yum install epel-release $ sudo yum install htop
--------- On RHEL 8 --------- $ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm $ sudo yum install htop --------- On RHEL 7 --------- $ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ sudo yum install htop
$ sudo yum install epel-release $ sudo yum install htop
To build Htop from sources, you must have Development Tools and Ncurses installed on your system, to do so run the following series of commands on your respective distributions.
$ sudo yum groupinstall "Development Tools" $ sudo yum install ncurses ncurses-devel
$ sudo apt-get install build-essential $ sudo apt-get install libncurses5-dev libncursesw5-dev
Next, download the latest htop from the Github repo and run the configure and make a script to install and compile htop.
$ wget -O htop-3.0.5.tar.gz https://github.com/htop-dev/htop/archive/refs/tags/3.0.5.tar.gz $ tar xvfvz htop-3.0.5.tar.gz $ cd htop-3.0.5/ $ ./configure $ make $ sudo make install
Now run the htop monitoring tool by executing the following command on the terminal.
Press F2 or S for setup menu > there are four columns i.e Setup, Left Column, Right Column, and Available Meters.
Here, you can configure the meters printed at the top of the window, set various display options, select among color patterns and choose which columns are printed in which order.
Type tree or t to display processes tree view.
You can refer to function keys displayed at the footer to use this nifty htop application to monitor Linux running processes. However, we advise using character keys or shortcut keys instead of function keys as they may have mapped with some other functions during secure connection.
Some of the shortcut and function keys and their functionality to interact with htop.
Здесь постараюсь собрать полезные «плюшки», которые облегчают жизнь системному администратору.
Запускаем терминал и начинаем ставить полезные программы
Начинающему системному администратору некоторые вещи удобнее делать при помощи WEBMIN. Установим его.
mkdir /opt/distr/ mkdir /opt/distr/webmin cd /opt/distr/webmin wget --no-check-certificate http://www.webmin.com/download/deb/webmin-current.deb apt -y install ./webmin-current.deb ufw allow 10000/tcp ufw reload
Теперь зайдя по адресу https://127.0.0.1:10000 мы получим удобный web-интерфейс для управления сервером.
Разрешаем подключаться пользователю root удалённо по SSH.
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
Включаем автозапуск службы SSH.
Включаем межсетевой экран
Разрешаем подключаться по SSH
Просим межсетевой экран перечитать правила.
Надёжные сервера с Pro-бегом
У ВАС В ОФИСЕ!
Безопасный доступ к своей 1С из офиса, командировки и т.п.!
IP-телефония давно перестала быть роскошью в офисах.
Хотите себе в офис цифровую АТС — обращайтесь. !