CentOS Debian Mint openSUSE Red Hat Ubuntu

tty (/dev/tty ) vs pts (/dev/pts) in Linux

tty dev vs pts in Linux

tty is simply the ports connected to the computer like a mouse, keyboard. pts are pseudo terminals that are SSH or telnet connections. You can understand tty and pts as connection channels to which Linux systems communicate with the client. Both are responsible for keeping sessions alive and sending packets.

In this article, I’ll give you a quick summary of the differences between tty (/dev/tty ) vs pts (/dev/pts) in Linux.

What is tty ?

Tty stands for teletype, however, it’s more commonly referred to as a terminal. It’s essentially a device that lets you interact with a system by delivering data (you input) to the system and viewing the system’s output. A standard terminal device is referred to as a tty (for example, the console on your server). ttys come in a variety of shapes and sizes. For example, you can use the Ctrl+Alt+Fn key combination to access graphical consoles, or terminal emulators like Gnome terminal to run inside an X session.

How does the tty command work?

Simply type ‘tty’ and the name of the terminal connected to standard output will appear in the output (or, in other words, the name of the current terminal).

Syntax : tty [option] ……

The following output was generated on my system,

options :

  • – – version: Prints the version information and exits
  • – – help: display the help message and exits
  • -s, ––silent, ––quiet: Nothing is printed; only the exit status is returned.

To put it another way, type TTY to find out what TTY number you’re connected to. You may also use the who command to see who else is connected to the Linux machine remotely if there are several users connected.

To get the list of open terminals, you can use the following command.

By default, the total number of allowed tty consoles is 6. You can switch tty1 to tty6 using CTRL+ALT+F[n] key combinations.

What is pts?

pts stands for pseudo terminal slave. Pts is the slave part of pty. A pty (pseudo-terminal device) could be a terminal device that another application simulates (example: telnet or ssh are such programs. A pseudo-terminal slave (pts) session is used when connecting to a Linux computer via another application, such as SSH or PuTTY. The tty command will show which pts session is currently active. When using an SSH connection, the Ctrl + Alt + F# combos will not work. Instead, numerous SSH connections would be used to create multiple virtual consoles.

You can simply view the pts channel with w command. In the following output, user kushal is connected to tty1 which might be a console connection and pts/0 which is through ssh.

Conclusion

The article gives you an idea on what are the differences between pts and tty. It also shows you how to overview the Linux system. Thank you for reading.

Similar Posts