Spend some time checking out the htop tool for viewing processes and system performance and you might just find it extremely handy when you need it. Credit: Canonmark / Getty Images While it’s one of the best tools for examining performance on Linux, htop still requires some explanation before you’ll be ready to take advantage of all the data it displays. It’s an excellent tool, but you need to understand the coloring scheme, how to scroll up and down through the processes displayed, and how to change your view of what’s happening on the system. It may take some time to get used to the type of information shown and be ready to quickly notice performance problems. That, of course, means that you have to know what normal behavior looks like on your system, and this generally requires spending time with the tool on a relatively frequent basis. In other words, use htop when you’re not at all concerned about how your system is performing and you’ll likely be able to make good use of it when you are. You can start htop in a terminal window or after logging in from another system using a tool like PuTTY. The htop display should look something like this: Sandra Henry-Stocker Stretch out the window and you’ll be able to see more details on more processes. The top left shows the number of CPUs/cores on the system and how busy they are. The colors are important, too. The green bars represent user processes, while red bars represent kernel processes. You may see other colors as well. The colors represent: Green – user processes Red – kernel processes Blue – low priority (nice) processes Turquoise – virtualized processes If you ask for help by pressing F1, you’ll see an explanation of the colors along with other information. Sandra Henry-Stocker Next comes memory and swap usage. Notice in the screenshot above that memory is being significantly used, but swap isn’t being used at all. Clearly this system is not very busy since it doesn’t have to swap process data out of memory. The upper right of the display shows you the number of tasks, threads (thr) and kernel threads (kthr). It also shows how many processes are currently running (using the CPU). In this case, there are 2. Sandra Henry-Stocker This portion of the display also shows load averages and uptime. The load averages show how heavily loaded the system has been over the last 1, 5 and 15 minutes. Uptime shows how long the system has been up in hours, minutes and seconds along with days if it’s been up more than a day (e.g., Uptime: 1 day, 20:18:15). The larger portion of the display shows the processes, organized by PID by default. You can scroll up and down to see additional processes using the up and down arrows on your keyboard. Sandra Henry-Stocker The fields displayed include this information for each process: PID – the process ID USER – the individual running the process PRI – process priority NI – the “nice” setting (priority reset by user) VIRT – virtual memory used RES – physical memory used SHR – shared memory used S – the current process state CPU% – the percentage of CPU used MEM% – the percentage of memory used TIME+ – the time the process has used since it started, measured in hundredths of a second (e.g., 2:34.56 means 2 minutes, 34 seconds and 56 hundredths of a second) Command – the command being run To sort the display by CPU usage, press the F6 key and select select PERCENT_CPU. Then hit the enter key to get back to viewing the processes using the new sort order. As you can see, a number of sorting options are available. Sandra Henry-Stocker When you start htop up again, it will start using whatever sort order you last used. Quit htop by typing “q” or by using the F10 key. Wrap-up The htop tool provides a lot of important information on running processes and can be very useful when looking for problems that might slow down the system. Getting comfortable with using it can help you detect problems easily and quickly or verify that system performance is good. Related content how-to Compressing files using the zip command on Linux The zip command lets you compress files to preserve them or back them up, and you can require a password to extract the contents of a zip file. By Sandra Henry-Stocker May 13, 2024 4 mins Linux opinion NSA, FBI warn of email spoofing threat Email spoofing is acknowledged by experts as a very credible threat. By Sandra Henry-Stocker May 13, 2024 3 mins Linux how-to The logic of && and || on Linux These AND and OR equivalents can be used in scripts to determine next actions. By Sandra Henry-Stocker May 02, 2024 4 mins Linux how-to Using the apropos command on Linux By Sandra Henry-Stocker Apr 24, 2024 3 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe