I started to dig into the whole Linux pty and tty hell. I'm trying to understand how it works here in Linux so I was reading quite a lot of articles that covered this topic.

So far I know:

TTYs are TERMINALS which are the last "secretary" to talk to kernel. PTS are virtual terminals, that on the one end are connected to the TTY and on the other end are connected to the terminal-emulator (the one that we can for example open by clicking applications->system tools->terminal. or to ssh session(?). So ssh uses another pts.

That seems pretty clear to me because when I will do w in a shell on my system I get:

21:26:53 up 2 days, 11:35,  2 users,  load average: 0.11, 0.08, 0.08
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
kris     tty1     :0               Thu09    2days 52:28   0.05s pam: gdm-passwo
kris     pts/0    :0.0             21:18    0.00s  0.02s  0.01s w

The tty1 is a terminal session, which was started when I logged into my machine, and the pts/0 is a virtual terminal (instance of App -> System Tools -> Terminal).

However, what is the pty then? If I will connect to my server through ssh then another pts will be spawned, but when will another tty be spawned, and whats the point of pty, from the man pty it seems to me like it is this:

  1. Emulated terminal (gui terminal) talks to pts
  2. This pts in turn talks to pty , which talks to tty

That doesn't make sense.

Please try to explain it using examples because it is very easy to fall off with all the differences between consoles, terminals, virtual terminals, emulated terminals, pts, pty, tty.

marked as duplicate by slm, Anthon, jasonwryan, Gilles, Mat Jan 5 '14 at 9:31

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.

Browse other questions tagged or ask your own question.