6

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.

Robeezy
  • 2,424
  • 3
  • 22
  • 28
  • http://www.linusakesson.net/programming/tty/index.php Here you go. A thorough explanation of TTY. – rdrey Nov 14 '12 at 22:49
  • You can set the env `DEBUG_COLORS` to force colored output. ref https://github.com/visionmedia/debug/commit/861fffaa9e369dd0284d0170f2400976dc924716 – Dan D. Nov 14 '12 at 23:22
  • @DanD. Don't think that's been released yet. The [current version](https://npmjs.org/package/debug), [0.7.0](https://github.com/visionmedia/debug/tree/0.7.0), is dated a few weeks before it. – Jonathan Lonowski Nov 14 '12 at 23:46

2 Answers2

2

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

byaruhaf
  • 4,128
  • 2
  • 32
  • 50
1

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.

Jonathan Lonowski
  • 121,453
  • 34
  • 200
  • 199