Meant by pts/0 and pts/1 in the output of ps -aux

gnomepstty

I am reading the book Unix Power Tools, and came across the ps command. The output of command ps xas given in the book is :

PID   TTY STAT TIME COMMAND
18034 tty2 S 0:00 -zsh
18059 ?    S 0:01 ssh-agent
18088 tty2 S 0:00 sh /usr/X11R6/bin/startx
18096 tty2 S 0:00 xinit /etc/X11/xinit/xinitrc -- :0 -auth /home/jpeek/
18101 tty2 S 0:00 /usr/bin/gnome-session
18123 tty2 S 0:33 enlightenment -clientId default2
18127 tty2 S 0:01 magicdev --sm-client-id=default12
18141 tty2 S 0:03 panel --sm-client-id default8
18145 tty2 S 0:01 gmc --sm-client-id default10
18166 ? S 1:20 gnomepager_applet --activate-goad-server gnomepager_a
18172 tty2 S 0:01 gnome-terminal
18174 tty2 S 0:00 gnome-pty-helper
18175 pts/0 S 0:00 zsh
18202 tty2 S 0:49 gnome-terminal
18203 tty2 S 0:00 gnome-pty-helper
18204 pts/1 S 0:01 zsh
18427 pts/1 T 0:00 man zshjp
18428 pts/1 T 0:00 sh -c /bin/gunzip -c /home/jpeek/.man/cat1/zshjp.1.gz
18430 pts/1 T 0:03 /usr/bin/less -is
18914 pts/1 T 0:02 vi upt3_changes.html
1263 pts/1 T 0:00 vi urls.html
1511 pts/1 T 0:00 less coding
3363 pts/1 S 0:00 vi 1007.sgm
4844 tty2 S 0:24 /usr/lib/netscape/netscape-communicator -irix-session
4860 tty2 S 0:00 (dns helper)
5055 pts/1 R 0:00 ps x

Can someone help in decoding this output?
What is meant by pts/0 and pts/1?

  1. All I could find was that pts stands for "pseudo terminal slave", but couldn't understand the difference behind pts/0 and pts/1.
  2. Why is there a "?" in TTY column? Why is the tty unknown for that process?
  3. What is the meaning of various Gnome applications such as "gnome-pty-helper" and "gnomepager_applet"?

Many Thanks.

Best Answer

  1. They are different instances of a pseudo terminal. E.g. they are different tabs in a Terminal window.
  2. There is no TTY. This process has detached from the tty. Using the TIOCNOTTY ioctl(), or setsid(). This is traditionally done to become a background process a.k.a. "daemon", which will not automatically be killed by SIGHUP when logging out from a terminal. (If it is a gnome process as in this example, it will likely be expected to terminate by some other mechanism).

    Alternatively it may never have had a TTY to start with, as with processes started for a systemd service for example.

Related Question