wShow who is logged in and what they're doing
w prints the uptime and load averages, then one line per logged-in user with where they came from, how long they've been idle, how much CPU their session used and the command they're running right now. It's who and uptime with process detail.
w [-h] [-s] [-i] [-p] [USER]A CPU alert fired on devops-lab. Before digging into services, check whether someone logged in is running something heavy.
wSession and activity overview (procps).
The first line is the same as uptime: the current time, time since boot from /proc/uptime, the number of user sessions and the 1, 5 and 15 minute load averages from /proc/loadavg. For each session w gets the user, terminal, origin and login time from utmp (on newer systemd builds, from logind). IDLE is the time since the terminal device was last read or written. For the processes on that terminal it scans /proc: JCPU is the CPU time of all processes attached to the terminal, PCPU the time of the current foreground process, and WHAT is that foreground process's command line. That's how you can see that a user is running a heavy query or a tail -f without opening top.
-hNo header (no uptime line, no column names)-sShort format: drop LOGIN@, JCPU and PCPU-iShow IP addresses instead of hostnames in FROM-fToggle the FROM column-pShow the PID(s) of the process in WHAT-uIgnore the current username when working out the process (with su)-oOld style: blank idle times under one minuteUSERLimit the list to one userReading the load average as a CPU percentageLoad is the average number of tasks running or waiting (including uninterruptible I/O waits). 4.0 on a 16-core box is light; on 2 cores it's overloaded.
Compare load with nproc, and use top or vmstat to see whether it's CPU or I/O waitKilling whatever w shows in WHAT without checkingWHAT shows the foreground process on the terminal; it may be a migration or a production fix a teammate is running.
Use w -p to get the PID, inspect it with ps, talk to the user, renice if neededConcluding that 'nobody is logged in' because w lists no usersw only shows terminal sessions. Cron jobs, services and non-interactive ssh commands never appear.
Use top or ps -eo user,pid,pcpu,cmd --sort=-pcpu to see what really uses the machineTry these on a Linux machine of your own. Each task has a hint and a solution.
Show who is logged in and what they are doing, without the header lines.
Show only your own sessions in the short format.
Compare the first line of w with the output of uptime. Then compute whether the load is high for this machine.
wShow who is logged in and what they're doing
w prints the uptime and load averages, then one line per logged-in user with where they came from, how long they've been idle, how much CPU their session used and the command they're running right now. It's who and uptime with process detail.
w [-h] [-s] [-i] [-p] [USER]A CPU alert fired on devops-lab. Before digging into services, check whether someone logged in is running something heavy.
wSession and activity overview (procps).
The first line is the same as uptime: the current time, time since boot from /proc/uptime, the number of user sessions and the 1, 5 and 15 minute load averages from /proc/loadavg. For each session w gets the user, terminal, origin and login time from utmp (on newer systemd builds, from logind). IDLE is the time since the terminal device was last read or written. For the processes on that terminal it scans /proc: JCPU is the CPU time of all processes attached to the terminal, PCPU the time of the current foreground process, and WHAT is that foreground process's command line. That's how you can see that a user is running a heavy query or a tail -f without opening top.
-hNo header (no uptime line, no column names)-sShort format: drop LOGIN@, JCPU and PCPU-iShow IP addresses instead of hostnames in FROM-fToggle the FROM column-pShow the PID(s) of the process in WHAT-uIgnore the current username when working out the process (with su)-oOld style: blank idle times under one minuteUSERLimit the list to one userReading the load average as a CPU percentageLoad is the average number of tasks running or waiting (including uninterruptible I/O waits). 4.0 on a 16-core box is light; on 2 cores it's overloaded.
Compare load with nproc, and use top or vmstat to see whether it's CPU or I/O waitKilling whatever w shows in WHAT without checkingWHAT shows the foreground process on the terminal; it may be a migration or a production fix a teammate is running.
Use w -p to get the PID, inspect it with ps, talk to the user, renice if neededConcluding that 'nobody is logged in' because w lists no usersw only shows terminal sessions. Cron jobs, services and non-interactive ssh commands never appear.
Use top or ps -eo user,pid,pcpu,cmd --sort=-pcpu to see what really uses the machineTry these on a Linux machine of your own. Each task has a hint and a solution.
Show who is logged in and what they are doing, without the header lines.
Show only your own sessions in the short format.
Compare the first line of w with the output of uptime. Then compute whether the load is high for this machine.