What does '(:0)' in the output of the command 'who' mean?

Solution 1:

From the info page (info coreutils 'who invocation')

If given no non-option arguments, ‘who’ prints the following information for each user currently logged on: login name, terminal line, login time, and remote hostname or X display.

So (:0) simply means X display number 0 on the localhost.

If there are remote users (for example SSH sessions) as well, you may see something like

$ who
steeldriver tty7         2016-12-15 13:57 (:0)
steeldriver pts/4        2017-01-12 09:32 (192.168.1.4)

Solution 2:

As you can find out in the manpage by typing man who, you can enable column headings with the -H option:

$ who -H
NAME          LINE         TIME             COMMENT
bytecommander tty7         2017-01-12 15:26 (:0)
guest-c62iz5  tty8         2017-01-12 15:40 (:1)

I have to agree this is not very helpful though, and the manpage also doesn't contain any explanation of the values.

However, I think I can tell you what these columns mean anyway:

  • NAME is the username of each logged in user.
  • LINE seems to contain the TTY through which the user is logged in (TTY1-6 are terminals, TTY7-12 are used by the X display server to show graphical desktops; you switch between them using Ctrl+Alt+F1 - F12).
  • TIME is the date and time when the user logged in to their current session.
  • COMMENT in our cases shows the content of the $DISPLAY environment variable (normally :0) in braces, which is also used by the X display server. Only graphical TTYs should have such a value, this column is empty for me on the terminal TTYs.

    You can check the value of this variable using the command echo $DISPLAY. What exactly it means is described e.g. in What does DISPLAY=:0.0 actually mean? and What is DISPLAY=:0?.