TTY, Shell, prompt, terminal?

This is probably a noob question, but I have wondered for some time the difference between TTY and terminal like rxvt-unicode or Xterm (and less shell). Is TTY just a virtual device which runs terminal emulator like rxvt-unicode which runs shell like sh or bash?

If I have a freshly installed FreeBSD do I have only TTY + shell or TTY + terminal emulator + shell? If I want to enable colored output in TTY, then is it depended on TTY, terminal emulator or shell? This has really confused me. :D
 
Traditionally a TTY was a teleprinter. It was a typewriter/printer combination that was connected to the main computer unit. This was long before computers had screens and keyboards directly attached to them. It's basically still treated the same, but instead of the teleprinter you now have a screen and keyboard directly attached. So in a sense, terminals, consoles and whatnot are all TTYs. Only now we have different types, some are typically called the console (screen+keyboard attached to the computer) and others are remote TTYs, like telnet or ssh.

If I want to enable colored output in TTY, then is it depended on TTY, terminal emulator or shell?
All of the above actually. The TTY needs to support the color codes, the shell needs to be able to control them and the terminal/emulator needs to be able to print/show them (as an analog, consider watching a black/white movie on a color TV. Or a color movie on a black/white TV.)
 
Traditionally a TTY was a teleprinter. It was a typewriter/printer combination that was connected to the main computer unit. This was long before computers had screens and keyboards directly attached to them. It's basically still treated the same, but instead of the teleprinter you now have a screen and keyboard directly attached. So in a sense, terminals, consoles and whatnot are all TTYs. Only now we have different types, some are typically called the console (screen+keyboard attached to the computer) and others are remote TTYs, like telnet or ssh.


All of the above actually. The TTY needs to support the color codes, the shell needs to be able to control them and the terminal/emulator needs to be able to print/show them (as an analog, consider watching a black/white movie on a color TV. Or a color movie on a black/white TV.)

Thank you. That was a helpful answer.

My /etc/ttys has theses lines:
Code:
# name  getty                           type    status          comments
#
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none                            unknown off secure
#
ttyv0   "/usr/libexec/getty Pc"         xterm   on  secure
# Virtual terminals
ttyv1   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv2   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv3   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv4   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv5   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv6   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv7   "/usr/libexec/getty Pc"         xterm   on  secure
ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyu0   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
ttyu1   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
ttyu2   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
ttyu3   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
# Dumb console
dcons   "/usr/libexec/getty std.9600"   vt100   off secure

Could I change type xterm to urxvt?
 
Could I change type xterm to urxvt?
No. To make things a little bit more difficult, the xterm refers to the terminal type. The terminal type is a collection of codes, a bit like ASCII is a collection of specific codes to print characters, i.e. 65 is 'A', 66 is 'B' etc. The terminal type does something similar, it basically says if you print this code it will clear the screen, if you print that code you get underlines, or print this code and the text will switch to a blue color, etc. RXVT understands the xterm terminal type and knows how to deal with it. So there's no need to change it.
 
Back
Top