8 ms·
What is the exact difference between a terminal, a shell, a tty and a console?
- egiva 15y agoThis 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.
- burgerbrain 15y agoThis 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.
- deleted 15y ago[deleted]
- mbreese 15y agoWhy 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 15y agoThey 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.
- 7952 15y agoThis logic doesn't extend to computers as they are just so much more complicated.
- burgerbrain 15y agoIf someone is discussing the concepts with the wrong vocabulary, then that means they are sufficiently important to that person that the should have known about it. I wouldn't be noticing that many people don't understand the concepts if it were not relevant to these people. It's not like these are particularly deep subjects either, people directly interact with 2 of the 3 every day. They're not buried details, they're frontline human-computer interfaces. P.S. Understanding cars is very similar to understanding computers. There are numerous layers of abstraction in place that allow us to rope off areas of understanding for later. I would argue that there is actually more information to learn about cars than there is computers for a few reasons: 1) cars are jam packed full of computers these days. 2) there are half a dozen engineering and science disciplines involved in cars off the top of my head, and that number is only limited by the number I know the name of. 3) (depending on if we're pulling in computing hardware into the discussion or not..) cars are things built in the real world with imperfect knowledge of all the systems that go into them. You can be sure people a century ago were not paying a ton of attention to fluid dynamics in engine cylinders. You can always dig deeper into what is actually going on. My point is here is that if computers are more complicated than cars, it's not by much. I believe my comparison holds.
- justincormack 15y agoThe system as a whole is badly designed, extremely complex, and not maintained in Linux. See eg https://lwn.net/Articles/343828/ 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 15y agoYour "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.
- samstokes 15y agoEach time you have to answer "why does Ctrl-Left go back a word on my laptop, but when I ssh into my server, it just prints some weird characters?", it's useful to know the distinctions between terminals and shells.
- Jach 15y agoThat just sounds like a broken implementation of readline or some such. When I ssh, everything works fine. Anyway, the distinction is only important in very narrow cases. I've heard people say "Open a new terminal", "Open a new command window", "Open a new shell", and "Open a new console". They mean the same thing in this context. The contexts where they don't and where that fact needs to be spelled out don't come up very often. This unwarranted attention to detail is analogous to changing a flat tire with a friend by saying: "Hey, grab the spare wheel out of the trunk" vs. "Hey, grab the spare tire out of the trunk". This whole thread is like seeing that there are technical differences between a wheel and a tire in the context of a repair shop, but in the context of "get me the circular thing from the trunk that I can attach to my damn car to make it go again" they're the same, and then complaining when people use the second context and don't keep the terms distinct.
- burgerbrain 15y agoIt's not a broken implementation of readline, it's either a failure to use readline or improperly set terminfo. TTYs in canonical mode will support backspacing, but not moving around inside text. "Ctrl-Left go back a word on my laptop, but when I ssh into my server, it just prints some weird characters?" reaks of straight up canonical mode. And say you had this problem, guess what is not going to work? "I have a problem with my command window", "I have a problem with my console", "I have a problem with my TTY". This is why vocabulary is important.
- kapilkale 15y agoedit: SO back up, comment removed
- NARKOZ 15y agouse google cache http://is.gd/nMjEDM http://is.gd/nMjEDM
- Adaptive 15y agoLet'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 15y agoouch, 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.
- schiptsov 15y agoTerminal 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 15y agoA 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 15y agoI 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 15y agoYou 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/Telecommunications_device_for_the_deaf https://secure.wikimedia.org/wikipedia/en/wiki/Telecommunica...
- spc476 15y agoA terminal can also be a hardware device with a keyboard and monitor that is hooked up to a computer through a serial port. I used to have a VT102 hooked up to my Linux system at one point (it's in storage now).
- gurraman 15y agoThe second answer by andcoz ends with a great summary. I'd quote it here if copy on ipad worked on SE.
- saurik 15y ago"""So when you look to a "text window" on you linux system (under X11) you are looking to: a terminal emulator, connected to a virtual terminal, identified by a tty file, inside which runs a shell."""
- burgerbrain 15y agoIt should likely be noted that xterm connects to PTYs, not VTs. Otherwise correct.
- hexley 15y agoCan 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?
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]
- jonknee 15y agoI can zoom and select text just fine on an iPad... Odd.
- jonknee 15y agoHow does copy not work? I just opened the link on an iPad and was able to copy fine.