htop
htop is an alternative display for top, showing system processes.
By default, htop will order the processes by PID.
FreeBSD
echo linproc /compat/linux/proc linprocfs rw 0 0 >> /etc/fstab mkdir -p /usr/compat/linux/proc ln -s /usr/compat /compat mount linproc
Examples
Show processes being run by user mysql:
htop -u mysql
Display threads for user apache, sorted by how long they have been running:
htop -u apache --sort-key TIME
See how much memory apache threads are really using, highest values first:
htop -u apache --sort-key M_RESIDENT
Watching the system to see what programs are using the most memory, the highest percentage of CPU, the highest percentage of memory, and then running the longest time:
htop -u apache --sort-key M_RESIDENT htop -u apache --sort-key PERCENT_CPU htop -u apache --sort-key PERCENT_MEM htop -u apache --sort-key TIME
Display Values
The default values displayed are:
- PID
- USER
- PRIORITY
- NICE
- M_SIZE
- M_RESIDENT
- M_SHARE
- STATE
- PERCENT_CPU
- PERCENT_MEM
- TIME
- Command
Gotchas
htop's argument for sorting by keys is not consistent across versions, despite what the –help output may say. To sort by a key, use –sort-key <value>
, which will work everywhere.