Posts Tagged ‘unix’

linux tty is Your Friend

Tuesday, December 6th, 2011

tty stands for “teletypewriter” because it is much older than computers (otherwise it might be called something less stupid), with its roots dating back as far as 1869! That’s no typo. More on the history and details here if you’re interested.

What it is today:

“tty is a Unix command that prints to standard output the name of the terminal connected to standard input.” It is a core utility included in the basic linux kernel, so every linux user should be able to make use of this.

How to switch between tty:

You should be able to switch to a tty terminal by pressing “ctrl + alt +(F1-6)”. That is for GNU linux. I don’t know about others.

How it is useful to you:

Normally we use a terminal emulator if we are in GUI desktop, but sometimes it is necessary or better/faster/stronger to leave that desktop altogether and just access the system via command line. You know, without taking a long detour through GUI wonderland.

For example, I recently had a program bug out and lock up my GUI. Literally nothing was responding except for my ability to switch to a tty. This allowed me to easily kill the problem process and switch back to the desktop (located at ctrl +alt + F7 on Ubuntu). Without tty I would have been forced to do a hard power down and that is never nice. The great thing is that even in a worst case scenario you can just logout of your desktop environment via tty and then log back in.

The possibilities of what you can do with tty are limited only by what you can do via command line interface (CLI). I highly recommend getting familiarized with this little trick.