A modern top replacement for UNIX.
Compile with gcc:
gcc src/main.c -Iinclude -o vtopTo build the interactive view using ncurses, enable the WITH_UI flag:
make WITH_UI=1Otherwise, running make will build a simple command-line version
that prints the version number.
The -d/--delay option sets how often the display refreshes. The
interval is specified in seconds. The default is 3 seconds and the
valid range is 0.1–10 seconds. During interactive use you can
press + or - to adjust the delay in 0.1 s steps.
The -s option selects the sort field. Available values are:
pid– sort by process IDcpu– sort by CPU usagemem– sort by memory usagevsize– sort by virtual memory sizeuser– sort by usernamestart– sort by start time
The -b/--batch option runs without the ncurses interface and prints
plain text updates. Use -n N to limit the number of refresh cycles;
0 runs indefinitely. The -p option restricts the output to the
comma-separated list of PIDs given. The -C option filters processes by a
substring of the command name. The -E and -e options control the
units used when displaying memory. Both accept one of k, m, g, t,
p or e for kilobytes through exabytes. -E affects the summary line
while -e scales per-process values.
Use -m N to limit the number of displayed tasks.
The -w option allows overriding the screen width used by the ncurses
layout. When the specified width is smaller than the default, columns are
truncated to fit.
The -S/--secure flag disables sending signals and changing
process priorities. Use this when running vtop in restricted
environments.
The --accum option displays CPU time including dead children.
The --list-fields option prints all available column names and exits.
The -a/--cmdline flag shows the full command line instead of the short
command name.
Use -i/--hide-idle to start with idle processes hidden.
Use --hide-kthreads to hide kernel threads whose names begin with [.
Use -H/--threads to show individual threads instead of processes.
Use --irix to display CPU usage relative to a single CPU.
Use --per-cpu to show per-core CPU usage by default.
Use -V/--version to print the vtop version and exit.
Use -u USER or -U USER to show only processes owned by USER.
Use -C STR or --command-filter STR to display only tasks whose
command contains the given substring.
Use --state=R to display only tasks in state R (running). Use an empty
argument to clear the filter.
vtop -u aliceWhen running the ncurses interface you can press F3 or > to cycle to
the next sort field and < to go back.
Press F4 or o to toggle between ascending and descending order.
Additional shortcuts:
- Press
kto send a custom signal to a process. vtop will prompt for the PID and signal number. - Press
rto change a process's nice value. You will be asked for the PID and the new nice level. - Use
+and-to increase or decrease the refresh delay while running. - Press
cto toggle per-core CPU usage display. - Press
ato toggle between the short command name and the full command line. - Press
Hto toggle thread view (show individual threads). - Press
Kto hide or show kernel threads. - Press
ito hide or show processes with zero CPU usage. - Press
gto filter by process state (e.g.,Rfor running). - Press
Zto cycle through color schemes. - Press
xto toggle highlighting of the sorted column. - Press
bto toggle bold text in the process list. - Press
Sto toggle cumulative CPU time. - Press
Ito toggle Irix mode (no CPU scaling). - Press
Eto cycle through memory units used for display. - Press
F4oroto change the sort direction. - Press
Uto sort by user. - Press
Bto sort by start time. - Press
Cto sort by CPU usage. - Press
Mto sort by memory usage. - Press
spaceto pause or resume updates. - Press
hto open a small help window with available shortcuts. - Press
Wto save the current configuration. - Press
fto open the field manager. Usespaceto toggle visibility, including the CPU, SHR, READ and WRITE columns, andh/lto move the selected column left or right.
These controls operate on live processes. Ensure you have permission to signal or renice the target process. Running as root can terminate or slow critical system tasks, so use with care.
When the ncurses interface exits it writes the current options to
~/.vtoprc. This file stores the refresh interval, sort column, the
enabled columns and their order, the chosen memory units and the active color scheme. On the
next launch, vtop reads this file to restore the
previous settings. You can also press W at any time to save the
configuration manually.
Example output with the ncurses interface:
The table shows PID, CPU, USER, process name, state, priority,
nice value, virtual memory size, resident set size, shared
memory size, memory usage percentage, CPU usage, total CPU time,
bytes read from and written to storage and the process start time.
The header above the table displays the system load averages,
uptime and a full task state summary in the form
tasks <total> total, <running> running, <sleeping> sleeping, <stopped> stopped, <zombie> zombie.
$ vtop
load 0.00 0.01 0.05 up 1234s tasks 87 total, 1 running, 86 sleeping, 0 stopped, 0 zombie cpu 2.0% mem 27.3%
PID NAME STATE VSIZE RSS SHR RSS% CPU% TIME START
...
This project is licensed under the BSD 2-Clause "Simplified" License. See the LICENSE file for details.