Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 'who' command but I never understand how they are different ? Can somebody please explain me this ?

share|improve this question
@Michael: there is no reference to pseudo terminals in the other question. – Stéphane Gimenez Sep 23 '11 at 21:44
@Stephane There is in the accepted answer – Michael Mrozek Sep 23 '11 at 22:58
@Michael: sorry, I should have say there is no reference to pts (the other answer mentions it, but without explanations). – Stéphane Gimenez Sep 24 '11 at 0:06

marked as duplicate by Michael Mrozek Sep 23 '11 at 13:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

up vote 4 down vote accepted

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 resume:

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:

  1. 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).

  2. 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.

share|improve this answer

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.