tty Command in Linux with Examples

Posted in

tty Command in Linux with Examples
sangeeta.gulia

Sangeeta Gulia
Last updated on December 22, 2024

    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:

    tty [OPTION]....

    -s, ––quiet, ––silent

    Nothing is printed using these options; just the exit status is returned. The exit status are:

    1. 0: if standard input is coming from a TTY device, emulated or physical.
    2. 1: if standard input is not coming from a TTY device.
    3. 2: Syntax error, incorrect command line parameters were used.
    4. 3: A write error has occurred.

    ––help

    Displays a help message.

    ––addition

    Exits after printing the version information.

    Access TTY

    We can access TTY sessions by holding down the Ctrl+Alt keys and then clocking any function key.

    1. Ctrl+Alt+F1 : Opens the graphical desktop environment of the login screen.
    2. Ctrl+Alt+F2 : Opens the graphical desktop environment.
    3. Ctrl+Alt+F3 : Opens TTY 3.
    4. Ctrl+Alt+F4 : Opens TTY 4.
    5. Ctrl+Alt+F5 : Opens TTY 5.
    6. Ctrl+Alt+F6 : Opens TTY 6.

    Conclusion

    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:

    Leave a Comment on this Post

    0 Comments