I keep hearing about these things known as
what are they
how can I access them
what do they do?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
tty is one of those funky Unix commands that prints the name of the terminal connected to standard input.
TTY's are text-only terminals commonly used as a way to get access to the computer to fix things, without actually logging into a possibly b0rked desktop.
Related: What is tty7 in the commandline?
By default Ubuntu has 7 tty's.
1-6are command line only and
7runs your X session (your normal desktop).
1, GUI desktop on
2and command lines on
To access them, use this keyboard shortcut:
Ctrl + Alt + F1 (or F3 on 17.10 and newer)
(changing F1 to F1-F6 to access the terminal that you want)
To get back to your GUI session (the normal desktop):
Ctrl + Alt + F7 (or F2 on 17.10 and newer)
A tty, short for teletype and perhaps more commonly called a terminal, is a device which lets you interact with the system by sending and receiving data, such as commands and the output they produce.
There are many kind of ttys, but nowadays most ttys are implemented in software, such as the graphical consoles you can access with Ctrl+Alt+Fn, or terminal emulators such as Gnome terminal that run inside an X session.
There is also a
tty command, which shows the device node of the terminal in which it is running (or prints "not a tty" if it is not running inside a terminal; yes, it is possible to run commands outside a terminal). For example:
firas@itsuki ~ % tty /dev/pts/0 firas@itsuki ~ % ssh localhost tty not a tty
When I am logged in and running a shell on the machine, the shell is normally running inside a terminal, namely here it is
/dev/pts/0. However, when I run
ssh host command to run a command on a remote host, the command is not run inside a terminal.
You can change the displayed TTY by commmand line with
sudo privileges), from SSH for example. Here is the relevant part of the manpage (
chvt - change foreground virtual terminal
The command chvt N makes /dev/ttyN the foreground terminal. (The corresponding screen is created if it did not exist yet. To get rid of unused VTs, use deallocvt) The key combination (Ctrl-)LeftAlt-FN (with N in the range 1-12) usually has a similar effect.
It changes your workspace: for example, you could have a text file open and change to tty2 then you might have a /ls command for reference. This is very helpful for an environment like Ubuntu Server.
This is the equivalent of having two tabs open in a GUI Environment.
In Ubuntu Server (16.04.3 LTS - for me) I can use ALT+F1-F6 or use ALT+LeftArrow to go back a number or ALT+RightArrow to go forwards a number.
You can see your tty by logging out from Ubuntu Server (run
logout) and see up at the top
Ubuntu 16.04.3 LTS ubuntu tty# that is standard, but may differ from version to version.
If your tty isn't shown on your login screen then you can run
sudo nano /etc/issue and at the top, you can put in whatever you like but to add the tty you need to place
\n for the hostname.
Ubuntu 16.04.3 LTS \n \l
Ubuntu 16.04.3 LTS ubuntu tty#
# refers to a number