Top
Jump to navigation
Jump to search
Internal
Overview
Display per VM information and per process information.
top - 14:44:47 up 4 min, 1 user, load average: 0.00, 0.01, 0.01 Tasks: 87 total, 2 running, 85 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.5 us, 0.5 sy, 0.0 ni, 98.8 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1017160 total, 787000 free, 88844 used, 141316 buff/cache KiB Swap: 1048572 total, 1048572 free, 0 used. 793204 avail Me PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 201660 3932 2412 S 0.0 0.4 0:00.48 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
Physical memory summary information:
- total physical memory. The same value as /proc/meminfo MemTotal.
- free physical memory. The same value as /proc/meminfo MemFree.
- used physical memory. The memory is used by process, but not in buffers and cache.
- buffers/cache physical memory. The represents the sum of /proc/meminfo Buffers and /proc/meminfo Cached.
The relationship between the values described above is represented by the formula:
tots = free + used + buff/cache
Virtual memory summary information:
Line 2 reflects mostly virtual memory, classified as: total, free, used and avail (which is physical memory)
The avail number on line 2 is an estimation of physical memory available for starting new applications, without swapping. Unlike the free field, it attempts to account for readily reclaimable page cache and memory slabs. It is available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free.
In the alternate memory display modes, two abbreviated summary lines are shown consisting of these elements: a b c GiB Mem : 18.7/15.738 [ ... GiB Swap: 0.0/7.999 [ ...
Linux
Batch Mode
Run "top" in batch mode, just one iteration:
top -b -n 1
Only summary information (and one process for PID 0)
top -b -n 1 -p 0
Mac
Batch Mode
Specify one sample:
top -l 1
-l logging mode.
Get stats only for specific keys: -o <key>, where keys: ...
-n <nprocs> display only up to nprocs. 0 works, it only displays the system-wide stats.
top -l 1 -n 0