Possible Duplicate:
What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
I always see pts and tty when I use the who
command but I never understand how they are different? Can somebody please explain me this?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityPossible Duplicate:
What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
I always see pts and tty when I use the who
command but I never understand how they are different? Can somebody please explain me this?
A tty is a native terminal device, the backend is either hardware or kernel emulated.
A pty (pseudo terminal device) is a terminal device which is emulated by an other program (example: xterm
, screen
, or ssh
are such programs). A pts is the slave part of a pty.
(More info can be found in man pty
.)
Short summary:
A pty is created by a process through posix_openpt()
(which usually opens the special device /dev/ptmx
), and is constituted by a pair of bidirectional character devices:
The master part, which is the file descriptor obtained by this process through this call, is used to emulate a terminal. After some initialization, the second part can be unlocked with unlockpt()
, and the master is used to receive or send characters to this second part (slave).
The slave part, which is anchored in the filesystem as /dev/pts/x
(the real name can be obtained by the master through ptsname()
) behaves like a native terminal device (/dev/ttyx
). In most cases, a shell is started that uses it as a controlling terminal.
A tty
is a regular terminal device (the console on your server, for example).
A pts
is a psuedo terminal slave (an xterm
or an ssh
connection).
man pts
has a verbose description of pseudo terminals.