- htop is an interactive system-monitor process viewer.
- It’s a utility for process monitoring.
- It is an alternative to the Linux program top.
- It displays a frequently updated list of processes running on a system with default ordered by of CPU usage.
Installation and usage:
- Ubuntu: sudo apt-get install htop
- MAC: sudo brew install htopAfter installation just run htop in the terminal and it will show a visual interface of process list with many features to interact with those processes.
Features of htop:
- It uses color to for visual information about processor, swap and memory status etc.
- Scroll vertically and horizontally so as to view processes with their full commands running.
- View CPU, Memory, swap usage, total tasks, number of tasks running, Load average, uptime of the system.
- Displays all individual CPU of the system with respective CPU usage.
- Select process and scroll process list – Using Up/Down arrow keys.
- View process list as tree view (.e. process and its subprocesses as tree view) – Using F5 key or ‘t‘ key.
- Search by process id – Just type the process id and the process will be searched and selected.
- Search by any name – Using F3 key or ‘/‘ key and then enter the search word to search.
- Kill a process – Using F9 key or k.
- Change priority of the process – Using F7 and F8 key. (you’ll have to be root to give anything really high priority that is run htop as root user)
- Sort process list:
- by specific column – Using F6 key and selecting the desired column.
- by CPU% – Using P key
- by MEM% – Using M key
- by TIME – Using T key
- by ascending or descending order for the sorted column – Using F4 key or I key.
- List open files used by a process – Using l key
- Trace process system calls: if strace is installed, live update of system calls issued by the process can be viewed – Using the s key.
- Tag or untag processes for quick reference and view for analyzing – Using space to tag/untag, U to untag all tagged processes.
- customize the user interface to display/remove information from view, choose a color theme for output, columns need to be displayed for the processes – Using F2 key.
- View processes of the selected user, hide/show users thread or kernel threads.
Below are the key to be used to interact with processes in htop interface.
Process columns:
- PID: Process ID of a process.
- USER: User owning the process.
- PR: Priority of the process.
- NI: Nice value for a process to set process priority.
- VIRT: Virtual memory consumption.
- RES: Physical RAM consumption in kilobytes.
- SHR: Shared memory consumption.
- S: Process status
- S: sleeping (idle),
- R: running,
- D: disk sleep (uninterruptible),
- Z: zombie (waiting for the parent to read it’s exit status),
- T: traced or suspended (e.g by SIGTSTP),
- W: paging
- CPU%: CPU consumption.
- MEM%: Physical RAM consumption.
- TIME+: Processor time used by the process.
- COMMAND: Command that started the process.
Colour:
- cpu usage:
- Blue: low priority processes (nice > 0).
- Green: normal (user) processes.
- Red: kernel processes.
- Yellow: IRQ time.
- Magenta: Soft IRQ time.
- Grey: IO Wait time.
- memory usage:
- Green: Used memory pages.
- Blue: Buffer pages.
- Yellow: Cache pages.
References:
This is a lot better than top 🙂