Everything in the Linux operating system is represented as a file, even the physical devices that we connect. A file can also be used to represent a terminal. There is a command named tty that shows terminal-related information of the files. In this article, we will discuss various options related to the tty command.
tty Command in Linux
Terminal's tty command simply outputs the filename of the terminal linked to standard input. TTY stands for teletype, although it is more often known as a terminal. It allows you to interact with the system by delivering data to it and viewing the output it produces. The syntax is:
-s, ––quiet, ––silent
Nothing is printed using these options; just the exit status is returned. The exit status are:
- 0: if standard input is coming from a TTY device, emulated or physical.
- 1: if standard input is not coming from a TTY device.
- 2: Syntax error, incorrect command line parameters were used.
- 3: A write error has occurred.
Displays a help message.
Exits after printing the version information.
We can access TTY sessions by holding down the Ctrl+Alt keys and then clocking any function key.
- Ctrl+Alt+F1 : Opens the graphical desktop environment of the login screen.
- Ctrl+Alt+F2 : Opens the graphical desktop environment.
- Ctrl+Alt+F3 : Opens TTY 3.
- Ctrl+Alt+F4 : Opens TTY 4.
- Ctrl+Alt+F5 : Opens TTY 5.
- Ctrl+Alt+F6 : Opens TTY 6.
In this article, we discussed various options related to the tty command that outputs the filename of the terminal linked to standard input, which provides various options and shortcuts to operate on the terminals.
People are also reading: