I run w
command on two machines. They both have exactly the same system installed: Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64). I am logged in as hans on both machines through SSH.
machine foo:
$ w
13:18:20 up 26 days, 6:02, 1 user, load average: 0.02, 0.03, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
hans pts/0 10.xxx.xxx.xxx 10:14 1.00s 0.08s 0.00s w
machine bar:
$ w
13:11:17 up 46 days, 46 min, 1 user, load average: 0.02, 0.04, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
hans pts/0 10.xxx.xxx.xxx 10:14 0.00s 0.02s 0.02s sshd: hans [priv]
Why is the output different in column WHAT
? On foo I see w
and on bar: sshd: hans [priv]
. Where does this asymmetry come from?
Best Answer
The
w
command uses a heuristic to decide which process to show as the current process. The Linux man page doesn't explain how this works, but on my OS X system it says:The failure modes described there could explain the inconsistent behavior you see.