Capture one non-interactive process snapshot
Build a paste-ready command, then review its compatibility and effects before running it.
top -b -n 1 | head -20read-onlyno known side effects Compatibility
LinuxmacOS top uses different batch-mode options.
Operational knowledgereview due 2027-01-19
Requirementstoptop must be installed and available on PATH.
Version supporttop Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalstop - 10:42:18 up 12 days, 3:14, 2 users, load average: 0.18, 0.24, 0.20Representative successful output; values vary with the selected target and system state.
Known errorstop: command not foundtop is missing or is not available on PATH.
Verifytop -b -n 1 | head -20The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01topCommandRuns the top stage of this one-liner.
02-bOptionConfigures top with the -b option.
03-nOptionApplies the command-specific numeric, dry-run, or non-resolving mode.
05|PipelinePasses the output on the left to the command on the right.
06headCommandRuns the head stage of this one-liner.
07-20OptionConfigures head with the -20 option.
Example input
top -b -n 1 | head -20
Example output
top - 10:42:18 up 12 days, 3:14, 2 users, load average: 0.18, 0.24, 0.20
Tasks: 214 total, 1 running, 213 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.1 us, 0.8 sy, 0.0 ni, 96.8 id, 0.3 wa
MiB Mem : 32018.4 total, 12764.1 free, 8612.7 used, 10641.6 buff/cache
PID USER PR NI VIRT RES %CPU %MEM COMMAND
1842 app 20 0 2387456 214332 4.0 0.7 node
Illustrative output — exact values vary by system and data.
Official sources