4

I have logged in from tty6, then logged out. Now, executing the w command from a terminal inside unity gives the following output:

mark@mark-Latitude-D620:~$ w
19:27:19 up  2:40,  3 users,  load average: 0.41, 0.61, 0.46
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
mark     tty7                      16:47    2:39m  5:06   0.22s gnome-session -
mark     pts/2    :0.0             19:13    7.00s  0.30s  0.00s w

Isn't the command supposed to list only the logged in users? I am using Ubuntu 12.10.

Edit

Note that the w command reports that 3 users are logged in (in the header) but only shows 2 entries.

1 Answer 1

6

There's nothing surprising about this w output. If you look at the second column under the TTY heading, it says the two logins are from tty7 (not tty6!) and pts/2. Now tty7 is your graphical log in (see the WHAT column) and pts/2 is a pseudo-terminal device which is the terminal emulator you opened to run the w command (again, see the WHAT column).

Update

It seems that the wrongly reported number of users can occur sometimes when your /var/run/utmp, which w makes use of, is corrupt.

The solution I found suggested on the Internet is to truncate this file (perhaps in single-user mode) and retry logging in:

# >/var/run/utmp
# reboot

Proceed with caution, though, it is suggested that users logged in while you nuke /var/run/utmp will experience "weirdness", which is why people recommend you do this in single-user mode.

Sources

6
  • 1
    it says 3 users
    – Hinklo
    Sep 28, 2013 at 21:05
  • @user1298069 You're right, that is weird. I tried but couldn't reproduce your issue (I logged in at tty1 then logged back out): w produces the correct output in my case. What do you get with last|head?
    – Joseph R.
    Sep 28, 2013 at 21:09
  • I have just logged again from an other tty and now it says 4 users even that I have logged out
    – Hinklo
    Sep 28, 2013 at 21:13
  • @user1298069 Can you please update the question with the output of last|head?
    – Joseph R.
    Sep 28, 2013 at 21:13
  • what is the exact command?
    – Hinklo
    Sep 28, 2013 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .