Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a TTY and how can I enable it on Ubuntu?

I'm currently setting up a node.js server and I'm using the debug module here https://github.com/visionmedia/debug.

I'm trying to enable it so I can get the colored debugging information in my output, however my terminal looks like the last terminal screen at the bottom after it says:

When stdout is not a TTY, Date#toUTCString() is used, making it more useful for logging the debug information as shown below:

Can anyone shed some light on this? Thanks.

like image 205
Robeezy Avatar asked Nov 14 '12 22:11

Robeezy


People also ask

What is tty Ubuntu?

tty is short of teletype, but popularly known as a terminal it allows you to interact with the system by passing on the data (you input) to the system, and displaying the output produced by the system.

What are tty devices Linux?

A tty device gets its name from the very old abbreviation of teletypewriter and was originally associated only with the physical or virtual terminal connection to a Unix machine. Over time, the name also came to mean any serial port style device, as terminal connections could also be created over such a connection.

What is tty in terminal?

A tty terminal device is a character device that performs input and output on a character-by-character basis. The communication between terminal devices and the programs that read and write to them is controlled by the tty interface. Examples of tty devices are: Modems. ASCII terminals.


2 Answers

tty is one of those funky Unix commands that prints (or, displays) to standard output the name of the terminal connected to standard input.

These are 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-6 are command line only, 7 runs your X session (your normal desktop).

To access them, use this keyboard shortcut:

Ctrl + Alt + F1

(changing F1 to F1-F6 to access the terminal that you need)

To get back to your X session (the normal desktop),

Ctrl + Alt + F7

like image 191
byaruhaf Avatar answered Oct 16 '22 22:10

byaruhaf


The TTY is the terminal or command prompt itself.

The screenshots are demonstrating the different results when stdout is directed to the terminal/TTY (with colors and time diffs) vs. when it's redirected elsewhere, such as to a file (via > out and with timestamps).

It determines which format to use with tty.isatty.

Note that not all terminals support the ANSI escape codes it's using to display colors.

like image 22
Jonathan Lonowski Avatar answered Oct 16 '22 23:10

Jonathan Lonowski