Linux Command - htop
The Linux htop command is a process viewer similar to top.
- It can be used with a mouse.
- It is cross platform.
- Much more detail in the man page
- “Memory sizes in htop are displayed in a human-readable form. Sizes are printed in powers of 1024. (e.g., 1023M = 1072693248 Bytes)”
Command Line Options
| -d | Delay between updates, in tenths of a second. rounded up to 1/10 and down to 10 secs |
| -C | monochrome mode |
| -F=FILTER | filter stuff |
| -h | help |
| -p=PID,PID… | Show only the given PIDs |
| -s COLUMN | Sort by this column |
| -s help | show a column list |
| -u | Show only the processes of a given user |
| -U | Do not use unicode but ASCII characters for graph meters |
| -M | Disable support of mouse control |
| –readonly | Disable all system and process changing features |
| -V | Output version information and exit |
| -t | Show processes in tree view. |
| -H | Highlight new and old processes |
Interactive Commands
| Tab, Shift-Tab | Select the next / the previous screen tab to display. | |
| Up, Alt-k | Select (highlight) the previous process in the process list. | |
| Down, Alt-j | Select (highlight) the next process in the process list. | |
| Left, Alt-h | Scroll the process list left. | |
| Right, Alt-l | Scroll the process list right. | |
| PgUp, PgDn | Scroll the process list up or down one window. | |
| Home | Scroll to the top of the process list and select the first process. | |
| End | Scroll to the bottom of the process list and select the last process. | |
| Ctrl-A, ^ | Scroll left to the beginning of the process entry (i.e. beginning of line). | |
| Ctrl-E, $ | Scroll right to the end of the process entry (i.e. end of line). | |
| Space | Tag or untag a process | |
| c | Tag the current process and its children | |
| U | Untag all processes | |
| s | Trace process system calls: if strace(1) is installed, pressing this key will attach it to the currently selected process, presenting a live update of system calls issued by the process. | |
| l | Display open files for a process: if lsof(1) is installed, pressing this key will display the list of file descriptors opened by the process | |
| w | Display the command line of the selected process in a separate screen | |
| x | Display the active file locks of the selected process in a separate screen. | |
| F1, h, ? | Go to the help screen | |
| F2, S | Go to the setup screen | |
| F3, / | Search by command lines, highlight while typing, F3 for next, Shift-F3 for previous | |
| F4, \ | Filter by command lines, case-insensitive, no regex, separate terms with “ | ”, |
| F5, t | Tree view | |
| F6, <, > | Selects a field for sorting | |
| F7, ] | Increase the selected process’s priority (subtract from ‘nice’ value). | |
| F8, [ | Decrease the selected process’s priority (add to ‘nice’ value) | |
| shift - F7, } | Increase the selected process’s autogroup priority (subtract from autogroup ‘nice’ value) | |
| shift - F8, } | Decrease the selected process’s autogroup priority (add to autogroup ‘nice’ value) | |
| F9, K | “Kill” process: sends a signal which is selected in a menu | |
| F10, q | quit | |
| I | Invert the sort order | |
| +, -, * | When in tree view mode, expand or collapse subtree. | |
| a | (on multiprocessor machines) Set CPU affinity: mark which CPUs a process is allowed to use. | |
| u | Show only processes owned by a specified user. | |
| N | Sort by PID. | |
| M | Sort by memory usage (top compatibility key). | |
| P | Sort by processor usage (top compatibility key). | |
| T | Sort by time (top compatibility key). | |
| F | “Follow” process, selection bar stays on process when proc moves | |
| K | Hide kernel threads | |
| H | Hide user threads | |
| p | Show full paths to running programs | |
| Z | Pause/resume process updates. | |
| m | Merge exe, comm and cmdline, where applicable. | |
| Ctrl-L | Refresh: redraw screen and recalculate values. | |
| Numbers | PID search: type in process ID and the selection highlight will be moved to it. |
Columns
- Much more detail in the man page
| Command | The full command line of the process | |
| COMM | The command name of the process | |
| EXE | The abbreviated basename of the executable of the process | |
| PID | The process ID | |
| STATE (S) | Process state: S - sleeping,I - idle,R - running,D - disk sleep,Z - zombie, T - traced or suspended, W - paging | |
| PPID | The parent process ID. | |
| PGRP | The process’s group ID. | |
| SESSION (SID) | The process’s session ID. | |
| TTY | The controlling terminal of the process. | |
| TPGID | The process ID of the foreground process group of the controlling terminal. | |
| MINFLT | The number of page faults happening in the main memory. | |
| CMINFLT | The number of minor faults for the process’s waited-for children | |
| MAJFLT | The number of page faults happening out of the main memory. | |
| CMAJFLT | The number of major faults for the process’s waited-for children | |
| UTIME (UTIME+) | The user CPU time. | |
| STIME (STIME+) | The system CPU time. | |
| CUTIME (CUTIME+) | The children’s user CPU time. | |
| CSTIME (CSTIME+) | The children’s system CPU time. | |
| PRIORITY (PRI) | The kernel’s internal priority for proc | |
| NICE (NI) | The nice value of a process, from 19 (low) to -20 (high). | |
| STARTTIME (START) | The time the process was started. | |
| PROCESSOR (CPU) | The ID of the CPU the process last executed on. | |
| M_VIRT (VIRT) | The size of the virtual memory of the process. | |
| M_RESIDENT (RES) | The resident set size (text + data + stack) of the process ( proc’s used physical mem) | |
| M_SHARE (SHR) | The size of the process’s shared pages. | |
| M_TRS (CODE) | The text resident set size of the process (process’s executable instructions). | |
| M_DRS (DATA) | The data resident set size (data + stack) of the process | |
| M_LRS (LIB) | The library size of the process. | |
| M_SWAP (SWAP) | The size of the process’s swapped pages. | |
| M_PSS (PSS) | The proportional set size. | |
| M_M_PSSWP (PSSWP) | The proportional swap share of this mapping. | |
| ST_UID (UID) | The user ID of the process owner. | |
| PERCENT_CPU (CPU%) | The percentage of the CPU time that the process is currently using. T | |
| PERCENT_NORM_CPU (NCPU%) | The percentage of the CPU time, normalized by CPU count. | |
| PERCENT_MEM (MEM%) | The percentage of memory the process is currently using | |
| USER | The username of the process owner, or the user ID | |
| TIME (TIME+) | The time, measured in clock ticks that the process has spent in user and system time | |
| NLWP | The number of Light-Weight Processes (=threads) in the process. | |
| TGID | The thread group ID. | |
| CTID | OpenVZ container ID, a.k.a virtual environment ID. | |
| VPID | OpenVZ process ID. | |
| VXID | VServer process ID. | |
| RCHAR (RD_CHAR) | The number of bytes the process has read. | |
| WCHAR (WR_CHAR) | The number of bytes the process has written. | |
| SYSCR (RD_SYSC) | The number of read(2) syscalls for the process. | |
| SYSCW (WR_SYSC) | The number of write(2) syscalls for the process. | |
| RBYTES (IO_RBYTES) | Bytes of read(2) I/O for the process. | |
| WBYTES (IO_WBYTES) | Bytes of write(2) I/O for the process. | |
| CNCLWB (IO_CANCEL) | Bytes of cancelled write(2) I/O. | |
| IO_READ_RATE (DISK READ) | The I/O rate of read(2) in bytes per second, for the process. | |
| IO_WRITE_RATE (DISK WRITE) | The I/O rate of write(2) in bytes per second, for the process. | |
| IO_RATE (DISK R/W) | The I/O rate, IO_READ_RATE + IO_WRITE_RATE (see above). | |
| CGROUP | Which cgroup the process is in. For a shortened view see the CCGROUP column below. | |
| CCGROUP | Shortened view of the cgroup name that the process is in. | |
| OOM | OOM killer score. | |
| CTXT | Incremental sum of voluntary and nonvoluntary context switches. | |
| IO_PRIORITY (IO) | The I/O sched class and priority: R - Realtime, B - Best-effort, id - Idle | |
| PERCENT_CPU_DELAY (CPUD%) | The percentage of time spent waiting for a CPU (while runnable). | |
| PERCENT_IO_DELAY (IOD%) | The percentage of time spent waiting for the completion of synchronous block I/O. | |
| PERCENT_SWAP_DELAY (SWAPD%) | The percentage of time spent swapping in pages. | |
| AGRP | The autogroup identifier for the process. | |
| ANI | The autogroup nice value for the process autogroup. |
Config files
| ~/.config/htop/htoprc | user config, don’t hand edit |
| /etc/htoprc | default system config, read if user config doesn’t exist |
| $HTOPRC | override config location with this |