-s (silent) option causes tty to generate no output.It does is produce an exit value, however:
- 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.
The who Command
Other commands can reveal your TTY number. The who command will list information for all logged in users, including yourself.
User root is shown as connected to “:1”.
This represents the screen and keyboard physically connected to the
computer. Even though the screen and keyboard are hardware devices, they
are still connected to the multiplexor through a device file. tty reveals that it is /dev/pts/4.
Accessing a TTY
You can access a full-screen TTY session by holding down the Ctrl+Alt keys, and pressing one of the function keys.
Ctrl+Alt+F4 will bring up the login prompt of tty4.
If you log in and issue the tty command, you’ll see you are connected to /dev/tty4.
This isn’t a pseudo-teletype (emulated in software); it is a virtual teletype (emulated in hardware). It is using the screen and keyboard connected to your computer, to emulate a virtual teletype like the DEC VT100 used to do.
You can use function keys Ctrl+Alt with function keys F3 to F6 and have four TTY sessions open if you choose. For example, you could be logged into tty3 and press Ctrl+Alt+F6 to go to tty6.
To get back to your graphical desktop environment(GUI), press Ctrl+Alt+F2.
At one time, Ctrl+Alt+F1 through to Ctrl+Alt+F6 would open up the full-screen TTY consoles, and Ctrl+Alt+F7 would return you to your graphical desktop environment. If you are running an older Linux distribution, this might be how your system behaves.
This was tested on the latest release of Ubuntu, Kali Linux, Manjaro, Fedora, Arch and they all behaved like this:
- Ctrl+Alt+F1: Returns you to the graphical desktop environment log in screen.
- Ctrl+Alt+F2: Returns you to 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.
tty command gets its name from a device from the late
1800s, appeared in Unix in 1971, and is part of Linux and Unix-like
operating systems to this day.
Daaaaamn, I didn't even know it existed. Great Job
ReplyDelete