Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
The top part shows uptime and load average, the number of tasks per state, CPU use (us user, sy system, ni niced, id idle, wa waiting for I/O, st stolen by the hypervisor) and memory and swap. Below is the process list, refreshed every 3 seconds.
Keys work while it runs: k kill, r renice, M sort by memory, P by CPU, 1 each CPU, q quit. With -b it writes plain text for logs and scripts.
Zo schrijf je het
top [OPTION]...Belangrijkste delen
k- Kill: send a signal to a PID.
r- Renice a PID.
P/M/T/N- Sort by CPU / memory / time / PID.
1- Show every CPU.
c- Show the full command line.
u- Show only one user.
f- Choose and sort columns.
H- Show threads.
V- Forest (tree) view.
E/e- Change memory units (summary / list).
W- Save the settings in ~/.config/procps/toprc.
h- Help.
q- Quit.
Opties 19
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Start top
top top - 10:52:01 up 2:54, 2 users, load average: 0.15, 0.10, 0.09 Tasks: 182 total, 1 running, 181 sleeping, 0 stopped, 0 zombie %Cpu(s): 1.2 us, 0.5 sy, 0.0 ni, 98.1 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 3654.2 total, 2201.7 free, 812.4 used, 891.3 buff/cachePress q to leave.
2Sort by memory
top -o %MEMOr press M inside top.
3Only one user
top -u apacheWatch the web server processes.
4One process and its threads
top -H -p $(pidof chronyd)Which thread uses the CPU.
5Save one snapshot to a file
top -b -n 1 > /tmp/top-$(date +%H%M).txtEvidence for a slow-server ticket.
6Log every 10 seconds for one minute
top -b -d 10 -n 6 | grep -A 8 '^top' > /tmp/top.logA short performance log.
7Kill from top
topPress k, type the PID, press Enter (15) or type 9.
8Read the CPU line
top -b -n 1 | grep CpuHigh
wa= slow disk; highst= the hypervisor is overloaded; highsy= kernel work.9Find a crypto miner (security)
top -b -n 1 -o %CPU | head -12An unknown process at 100% CPU, often from /tmp or a strange user.
10Secure mode for a shared screen
top -sNobody can kill from this top.
Niets past bij dit filter.
Let op
- Load average counts waiting processes, also those waiting for disk. High load with low CPU use often means slow storage or NFS.
Bestanden
~/.config/procps/toprc- Saved settings (W key).
Exitcodes
0 :: Done. 1 :: Error.