27

When I type the command:

[root@degeneration Desktop]# who am i 
root     pts/0        2013-04-12 15:08 (:0.0)

What is pts/0 and what is meant by (:0.0)?

3 Answers3

25

The pts/0 is telling you which "pseudo terminal" the user is logged in on. In this case it's terminal #0. The "(:0.0)" tells you which hostname and display you're using.

who am i is an alias of command who -m. See the man page for who. You can also read about the who command here.

The output can definitely be confusing to a Unix novice.

examples

shows -m is same as am i

[root@grinch]$ who am i
root     pts/4        2013-04-12 07:10 (greeneggs.mydom.net)
[root@grinch]$ who -m
root     pts/4        2013-04-12 07:10 (greeneggs.mydom.net)

connected to some remote system

[sam@munger ~]$ who am i
sam      pts/0        2013-04-12 07:19 (192.168.1.7)

locally on my laptop

[saml@greeneggs ~]$ who am i
saml     pts/1        2013-04-11 16:41 (:0.0)

The last bit that still might be confusing you is the :0.0. This is how X Windows represents the "display" a user is on. The first "0" says which monitor/device you're on, the second "0" says which virtual display you're on.

This harks back to the days when computers were expensive and so multiple people might be working on the same computer all at the same time. I wouldn't worry about it, just remember that it's either going to be ":0.0" or possibly ":0". The environment variable "DISPLAY" and the command xhost make use of the ":0.0" value.

You can read more about remote displaying in Unix here.

whoami vs. who am i

Aren't they the same command? No they're different:

[saml@grinchy ~]$ ls -l /usr/bin/who /usr/bin/whoami
-rwxr-xr-x 1 root root 49432 Nov  3  2010 /usr/bin/who
-rwxr-xr-x 1 root root 26280 Nov  3  2010 /usr/bin/whoami

Also their output is completely different; whoami just shows you your effective userid while who am i shows you connection info about your terminal:

[saml@grinchy ~]$ who am i
saml     pts/0        2013-04-11 16:41 (:0.0)

[saml@grinchy ~]$ whoami
saml

See the whoami man page here.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
slm
  • 369,824
9

Quoting from here.

pts stands for pseudo terminal slave. A terminal (or console) is traditionally a keyboard/screen combination you sit and type at. Old UNIX boxes would have dozens of them hanging off the back, all connected with miles of cable. A pseudo terminal provides just the same facility only without the hardware. In other words, it's an xterm window or a konsole window, or whatever utility you use. They pop into life as you ask for them and get given sequential numbers: pts/0, then pts/1 and so on. The physical console is the hardware which is actually attached to your box - you probably only have one. That's labelled ":0" and is refered to as the actual "console".

superuser0
  • 1,710
1

you will find pts/0 listed in who output if there is a remote connection to ssh:

I am one and the only on my machine:

$ who
me    :0           2015-02-02 14:06 (:0)
me    pts/7        2015-02-02 14:07 (:0)
me    pts/12       2015-02-02 14:07 (:0)

I am connected from other machine to ssh server, so I have opened remote terminal:

$ who
me    :0           2015-02-02 14:06 (:0)
me    pts/7        2015-02-02 14:07 (:0)
me    pts/12       2015-02-02 14:07 (:0)
me    pts/0        2015-02-02 14:31 (x.server.something.com)
4pie0
  • 197
  • I don't think that's necessarily true - on my machine, right now, pts/0 is a local xterm that was started by ~/.config/openbox/autostart when I started openbox, shortly after logging in. I think, rather, that the system is allocating pts/[the lowest non-negative integer that isn't already in use] whenever it needs a new pseudoterminal, which will be pts/0 if pts/0 isn't already in use. – Chris Henry Oct 03 '22 at 19:10
  • On kde there seems to be a few if not all users that have pts/0 for /usr/bin/kded5 as shown by using the w command. Examples are given in the following links https://bbs.archlinux.org/viewtopic.php?id=281408 and https://bbs.archlinux.org/viewtopic.php?id=261008 – userrandrand Jan 11 '24 at 20:34