Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
w combines uptime and who, and adds the current program of each session. The first line shows the time, how long the system is up, the number of users and the load average (1, 5 and 15 minutes).
Columns: USER, TTY, FROM (remote address), LOGIN@ (login time), IDLE, JCPU (CPU of all processes of the terminal), PCPU (CPU of the current process) and WHAT (the current command).
Zo schrijf je het
w [OPTIONS] [USER]Opties 10
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 11
$ als gewone gebruiker# als root (of met sudo)
1Who does what?
w 09:12:01 up 1:14, 2 users, load average: 0.08, 0.12, 0.10 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT student tty2 tty2 08:10 1:02m 0.05s 0.03s /usr/libexec/gnome-session-binary admin pts/0 192.168.122.1 09:02 0.00s 0.04s 0.00s wLoad average under the number of CPUs is normal.
2Only one user
w adminSessions and current commands of admin.
3Without the header, for a script
w -hOne line per session.
4Short form
w -sFewer columns, easier to read on a small screen.
5IP addresses instead of names
w -iUseful when reverse DNS is slow or wrong.
6Show the process IDs of the current commands
w -pThen you can look at a process with
ps -fp PIDor stop it.7Find who runs a heavy command
Sort on JCPU to see the busy sessions.
8Check the load before a big job
w | head -1If the load is high, start the backup later.
9Find idle sessions to clean up
w -h | awk '$4 ~ /days/'Sessions idle for days. Ask the users or end them with
pkill -t pts/N.10Spot a suspicious session (security)
w -i | grep -v '192.168.122.'A login from an unknown network with a strange WHAT command needs attention.
11Compare with uptime
The first line of w is the uptime output.
Niets past bij dit filter.
Tips om te onthouden
- w = uptime + who + what. Look at load average and WHAT.