
What is the exact difference between a terminal, a shell, a tty and a console? - LiveTheDream
http://unix.stackexchange.com/questions/4126/what-is-the-exact-difference-between-a-terminal-a-shell-a-tty-and-a-cons/4132#4132
======
egiva
This was a great write-up, especially if you like your ol' unix history.
Aside: I love the stack exchange sites (i.e. stack overflow, etc) - they are
probably one of my top companies based just on how much I interact with their
sites.

------
gurraman
The second answer by andcoz ends with a great summary. I'd quote it here if
copy on ipad worked on SE.

~~~
hexley
Can anyone tell me why I can't zoom or select the text on this site on my
iPad? Isn't this the very sort of thing we hate in flash thoughtfully
recreated in HTML5?

~~~
jonknee
I can zoom and select text just fine on an iPad... Odd.

------
schiptsov
Terminal is a program of some kind, like xterm, (or a monochrome device with
nice smooth scrolling), shell is a different kind of program, that interpret
your input like bash. TTY is an interface to access a system over serial line,
and console is an interface pre-configured for administrative access. ^_^

~~~
jff
A terminal is a physical device for access to a computer. The VT-100 and
Teletype ADM-33 are both examples. Xterm is a _terminal emulator_ for X--it
pretends to be something like a VT-220, so you can run your text mode
programs.

TTY, of course, stands for Teletype, which was a common terminal used in the
early days of Unix. In the old days, you'd talk about having a whole room full
of TTYs. Now, it seems to refer to the emulated terminals provided by a Unix-
like system.

A console would originally be a specific terminal (often hard-copy, like a
Teletype) hooked directly to the computer for administrative tasks.

~~~
pyre
I remember seeing a a tty at a pay phone at a rest stop in Maine a few years
ago (maybe 2007). IIRC, it was for the deaf.

~~~
burgerbrain
You are correct. If you look at the bottom of posters/flyers for government
services (suicide help lines, schedule services for transit, that sort of
thing), you'll often see underneath "phone: " a line "TTY: " with a slightly
different phonenumber following.

[https://secure.wikimedia.org/wikipedia/en/wiki/Telecommunica...](https://secure.wikimedia.org/wikipedia/en/wiki/Telecommunications_device_for_the_deaf)

------
kapilkale
edit: SO back up, comment removed

------
burgerbrain
This should be taught in the first CS class at every school. It continues to
stun me how many CS grads in the US don't understand the difference between
these things.

~~~
mbreese
Why should they know the difference between these things? Unless they are
trying to implement a new terminal, there isn't much of a reason to know this
minutiae. The rationale for the differences between them are mainly historical
and not really a good design.

Now, I'm all for a "History of Computing" class being required for CS, but
that's another story. I also wish that I had time during undergrad for a
"History of Biology/Chemistry/science/alchemy" class (I was a biochem major).

~~~
burgerbrain
They should know what they are because _they use them every day_. It's like a
racecar driver not knowing the difference between an axle and a wheel, he
doesn't have to know how to make them or even fix them, but he should damn
well know what they're called. Understanding this issue is fundamental to
understanding Unix, and is also a superb way of introducing some classical IPC
methods. Last I checked most schools still devote a required class or two to
the subjects but somehow it fails to work a good deal of the time.

 _"The rationale for the differences between them are mainly historical and
not really a good design."_

The separation of shell, a terminal emulator, and a psuedo-terminal is bad
design? _Really?_ I would love to see a rationalization for that. EDIT: Or
downvotes will work fine as well I suppose.

~~~
justincormack
The system as a whole is badly designed, extremely complex, and not maintained
in Linux. See eg <https://lwn.net/Articles/343828/>

Sure there should be layering, but starting by emulating a serial port to
create an ssh session? Why is this in the kernel not in userspace?

~~~
burgerbrain
Your "system as a whole" is the linux TTY... so exactly _not_ the system as a
whole. Furthermore, Alan Cox stepping down 2 years ago does _not_ mean the
linux tty system is unmaintained. It is in fact.

The reasons ttys and ptys are in kernel space are numerous. As one example, it
needs to be there because different line disciplines are necessary and relying
on a userspace program to implement them will not do. Ever notice how
su/sudo/passwd/etc don't echo your password? Yeah, that sort of important.
Furthermore, ttys in modern systems are tied to job control rather deeply.
Implementing correct signal sending, sessions with controlling terminals,
forground/background processes, etc in userspace? Have fun.

I could write a book on this subject, but this is easier: "Write a fully
functional pty in userspace. If you ever manage to get that far, then compare
your work with traditional implementations and defend it."

PS: ptys are not "emulating" anything in any meaningful sense of the word.

~~~
justincormack
Userspace can not echo a password too, its not exactly difficult. And do we
really need the job control model as is? If you started from scratch would you
design it anything like this at all? And signals, it is all the least
successful parts of the unix design...

~~~
burgerbrain
If you are implementing all of your line disciplines in userspace 1) userspace
_where_? 2) How do you handle other modes, besides just noecho? 3) How do you
do that while minimizing responsibilities of user generated code?

 _"And do we really need the job control model as is?"_

Yes.

------
Adaptive
Let's be clear about this: a terminal is what you have to disinfect Friday
nights in the computer lab after a week of disgusting freshmen.

Wikipedia is sorely lacking in this critical detail.

~~~
Adaptive
ouch, the downvotes! for posterity let me note here that, in fact, I really
did have to clean vt220 keyboards with alchohol wipes every week when working
in the comp. lab. I have very fond memories of the vt220 despite this ignoble
responsibility. Not germane enough to the conversation but anyone that spent
time on a real terminal will hopefully relate.

