Monitor system resources using Htop command
Linux Administrator’s can’t run even a single day without using Top Command when they are in office because whenever server load is more our fingers automatically type top command in terminal without asking us. Most-of us are not familiar with Htop command because every time we use Top command, but Htop have many of features and options compared to top command. htop is an interactive process viewer for Linux which was developed by Hisham using ncurses library. Alternatively you Monitor system resources using iotop & iostat, SAR commands.
Advantage’s of HTOP command
- You can use mouse to interact with htop command
- Scroll the list vertically and horizontally to see all processes which are currently running
- Use Arrow, page up, page down keys to scroll
- Htop kill’s process automatically without PID
- Htop is Very fast
1) Install Htop
Follow the below steps to install Htop in linux. For CentOS/RHEL/Fedora you need to Enable EPEL repository because their official repository doesn’t have Htop package.
# Install Htop on Ubuntu/LinuxMint/Debian # $ sudo apt-get install htop # Install Htop on CentOS/RHEL/Fedora 21 & older systems # # yum install htop # Install Htop on CentOS/RHEL/Fedora 22 & later systems # # dnf install htop
2) Htop Output
See the below standard output for Htop command. Htop output can be considered as three parts (Header, Body & Footer).
- Header : Header shows the CPU usage, Memory usage, Swap usage, Load average and uptime of system.
- Body : Body shows the list of processes that are currently running.
- Footer : Footer shows htop menu option.
3) Sorting Htop Output
By default Htop sortes the output by CPU usage. If you want to sort the output with different options like Memory, PID, etc., You can do this by pressing F6 key. I’m going to sort the output by Memory.
See, now the below output is sorted by Memory.
4) Tree View
In default view you can see the Parent process in command section. Sometime that’s not enough to find the root causes and you want to see the child processes of a parent process, you can do this by pressing F5 key.