LinuxCommandLibrary

top

TLDR

Start top

$ top
copy
Do not show any idle or zombie processes
$ top -i
copy
Show only processes owned by a specific user
$ top -u username
copy
Sort processes by a field
$ top -o %MEM
copy
Show individual threads of a process
$ top -Hp process_id
copy
Monitor specific PIDs
$ top -p 1234,5678
copy
Run in batch mode for scripting
$ top -b -n 1
copy

SYNOPSIS

top [-b] [-d delay] [-n iterations] [-p pid] [-u user] [-o field]

DESCRIPTION

top provides a dynamic real-time view of a running system. It displays system summary information and a list of processes or threads currently being managed by the Linux kernel. The display is updated periodically and can be customized interactively.

PARAMETERS

-b, --batch

Run in batch mode (non-interactive), useful for piping output
-c, --cmdline-toggle
Toggle between command line and program name display
-d, --delay=SECS
Set the delay between screen updates
-e, --scale-task-mem
Scale task memory values (k/m/g/t/p)
-E, --scale-summary-mem
Scale summary memory values (k/m/g/t/p/e)
-H, --threads-show
Display individual threads instead of processes
-i, --idle-toggle
Hide idle and zombie processes
-n, --iterations=NUMBER
Set maximum number of iterations before exit
-o, --sort-override=FIELD
Override the default sort field
-p, --pid=PIDLIST
Monitor only specified process IDs
-u, --filter-only-euser=USER
Show only processes for specified effective user
-U, --filter-any-user=USER
Show processes for specified user (real, effective, saved, filesystem)

INTERACTIVE COMMANDS

h or ?: Display help screen
q: Quit top
d or s: Change delay between updates
k: Kill a process
r: Renice a process
f: Manage displayed fields
o: Add filter expression
c: Toggle command line/program name
V: Toggle forest view mode
1: Toggle single/separate CPU states
m: Cycle memory display modes
t: Cycle CPU states display modes
R: Reverse sort order
< or >: Move sort column left/right
W: Write configuration file

PROCESS STATUS CODES

D: Uninterruptible sleep
I: Idle kernel thread
R: Running
S: Sleeping (interruptible)
T: Stopped by job control signal
t: Stopped by debugger
Z: Zombie

CAVEATS

The configuration file is saved to ~/.config/procps/toprc. Running in batch mode (-b) is recommended for scripting as it disables interactive features and produces parseable output.

HISTORY

top was originally written by Roger Binns and has been part of the procps (now procps-ng) package. It has been a standard system monitoring tool on Unix-like systems since the 1980s.

SEE ALSO

htop(1), atop(1), ps(1), free(1), uptime(1)

> TERMINAL_GEAR

Curated for the Linux community

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

$239.99
Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99