This question already has an answer here:
I started to dig into the whole Linux
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
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:
- Emulated terminal (gui terminal) talks to
ptsin turn talks to
pty, which talks to
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,