2

Is a Virtual Terminal the terminal that you get when you type Ctrl+Alt+F#, and which is represented by the file /dev/tty#.

While a Pseudo Terminal is a terminal that actually runs "inside" a tty, for example: gnome-terminal, xterm, etc. And which is represented by the file /dev/pts/#.

Am I correct?

4
  • 1
    One important difference, is that pseudo-terminals always are pairs - one master and one slave. eg. /dev/ptyp4 (master) and /dev/ttyp4 (slave). These days this is somewhat hidden in that a program now uses /dev/ptmx - the psaudo-terminal multiplexer - to get the file-descriptor to a new master, while the corresponding slave is created under the /dev/pts/-directory. The virtual consoles don't have such a pairing (they just got the /dev/ttyn device), and they're directly connected to the kernel. Commented Apr 15, 2017 at 8:49
  • In addition we also got /dev/ttySn (also not pairs) which correspond to the serial-ports... This is where physical terminals - ie. teletypers or screen&keyboard-combos - would've been connected to the computer. Before the PC, such terminals connected to serial-lines, was how most people would use Unix-computer (eg. a mainframe). Commented Apr 15, 2017 at 8:53
  • Not a duplicate as indicated, since the accepted answer doesn't mention pseudo-terminals, and the one answer mentioning pseudo-terminals is largely incorrect. Commented Apr 15, 2017 at 10:54
  • Thomas, the accepted answer in the linked duplicate does mention "pseudo ttys"...?
    – Jeff Schaller
    Commented Apr 15, 2017 at 12:13

2 Answers 2

3

"Virtual Terminal" is a loosely defined term that can mean different things depending on who is talking. All terminals are virtual nowadays if opposing virtual terminals to physical terminals (e.g. a real DEC VT100).

On Linux, /dev/tty[n] are virtual consoles. They are virtual terminals (terminal emulators) implemented by the kernel and independent of the graphic environment, if any.

/dev/pts/# are channels used to interact with local or remote terminal emulators like gnome-terminal or Windows putty.

2
  • Just a note: the VT of VT100 is "video terminal" (to distinguish from teletype) not "virtual terminal" Commented Sep 30, 2021 at 5:48
  • @GiacomoCatenazzi That's correct. I precisely wrote that a VT100 is not a virtual terminal but a physical one.
    – jlliagre
    Commented Sep 30, 2021 at 8:35
1

A pseudo terminal is a kernel concept that was introduced to present terminal line discipline to programs so that the programs think they are talking to a real terminal. This enables the programs to work unmodified regardless if they are talking to a real terminal device (e.g. a serial port) or a pseudo terminal.

For example, the interface provided by a network connection does not look like a serial line at all, so a pseudo terminal pair (a master and a slave) is used. The network handler process opens the master side of the pseudo terminal and reads from it and writes to it. What is written to the master side appears for reading on the slave side, and vice versa. In addition all the ioctls for changing line discipline etc. are available on the file descriptors on the slave side.

In short, you could say that a pseudo terminal enables you to simulate a real terminal using software.

3
  • 1
    That's half - it doesn't help with distinguishing virtual terminals from pseudo-terminals. Also, there's no links to the information cited. Commented Apr 15, 2017 at 10:56
  • 1
    I was piggybacking on @lliagre's answer, which covered what a Virtual Terminal is. A terminal (real or virtual) and a pseudoterminal are different concepts. A virtual terminal is a software implementation of a real terminal, i.e. software that functions like a real terminal, but instead of using external harware components, uses a windowing system window (for example, an X11 window) for output and simulates a keyboard using the input events of the windowing system. A pseudoterminal is essentially a kernel software component ("driver" if you wish) that implements POSIX Terminal I/O. Commented Apr 15, 2017 at 11:36
  • en.wikipedia.org/wiki/POSIX_terminal_interface Commented Apr 15, 2017 at 11:39

Not the answer you're looking for? Browse other questions tagged .