Categories: TutorialsUbuntu

tty (/dev/tty ) vs pts (/dev/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
Sponsored
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.

Sponsored

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.

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Ubuntu Server Admin

Recent Posts

Building RAG with enterprise open source AI infrastructure

One of the most critical gaps in traditional Large Language Models (LLMs) is that they…

7 hours ago

Life at Canonical: Victoria Antipova’s perspective as a new joiner in Product Marketing

Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…

1 day ago

What is patching automation?

What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…

2 days ago

A beginner’s tutorial for your first Machine Learning project using Charmed Kubeflow

Wouldn’t it be wonderful to wake up one day with a desire to explore AI…

3 days ago

Ubuntu brings comprehensive support to Azure Cobalt 100 VMs

Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…

3 days ago

Ubuntu Weekly Newsletter Issue 870

Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…

4 days ago