Differences

This shows you the differences between two versions of the page.

Link to this comparison view

htop [2012/08/09 09:44] (current)
Line 1: Line 1:
 +====== htop ======
  
 +  * [[Linux Memory and Processes]]
 +
 +htop is an alternative display for top, showing system processes.
 +
 +By default, htop will order the processes by PID.
 +
 +=== FreeBSD ===
 +
 +<​code>​
 +echo linproc /​compat/​linux/​proc linprocfs rw 0 0 >> /etc/fstab
 +mkdir -p /​usr/​compat/​linux/​proc
 +ln -s /usr/compat /compat
 +mount linproc
 +</​code>​
 +
 +=== Examples ===
 +
 +Show processes being run by user mysql:
 +
 +<​code>​
 +htop -u mysql
 +</​code>​
 +
 +Display threads for user apache, sorted by how long they have been running:
 +
 +<​code>​
 +htop -u apache --sort-key TIME
 +</​code>​
 +
 +See how much memory apache threads are really using, highest values first:
 +
 +<​code>​
 +htop -u apache --sort-key M_RESIDENT
 +</​code>​
 +
 +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:
 +
 +<​code>​
 +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
 +</​code>​
 +
 +=== 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.