274 points · by ent101 · 2y ago · 64 comments
https://www.reddit.com/r/programming/comments/41u5hw/comment...
> A terminal is a physical device with a keyboard and screen connected to a computer running various OS types. A tty is the Unix device name for a physical or virtual terminal connection. A shell is the Unix command interpreter. A console is a generic term for a primary i/o device or interface. In unix terms the console is where the boot/startup messages are sent to. After bootup the console effectively becomes a terminal.
A tty can refer to a device name, or a physical terminal.
A terminal can refer to a physical or virtual terminal.
A console could also refer to a physical device, although I'm not aware of it being used in this context.
The problem is that computing is all metaphors. Metaphors leak and once we lose one meaning (enough) we stop clarifying to differentiate. We don't generally need to differentiate between a physical terminal and a virtual terminal, so we don't.
I thought that the console is used for any device (or application) that listens to /dev/console (at least on Linux).
SO really does attract misanthropes.
Then we can dig into actual differences: the shell is actually an application that runs inside the terminal/console, and you can swap in your favorite shell app; on MacOS, the Console and Terminal apps look similar, but Terminal is what you should use normally, with Console more for debugging system outputs. And so on.
Humor people with practical answers sometimes, for christsake, instead of these agonzing pendantic expositions. Side notes on pseudo-ttys, ioctl, virtual condoles, and control sequences when the OP posted an elementary question?? Yeah, we get it, professor: you are overburdened with information which you must share.
> Side notes on pseudo-ttys, ioctl, virtual condoles, and control sequences when the OP posted an elementary question?? Yeah, we get it, professor: you are overburdened with information which you must share.
I don't know if it's elementary but I knew ioctl long before I learned that "tty" stands for teletypewriter. (Top answer: "tty is a strange abbreviation". Me: ha, sure, because if you are curious enough to look up for the abbreviation, the long form itself is pretty much self explanatory).
The answer doesn't feel condescending to me. Similarly, my professor talked to me like that when I was a student and I didn't find that condescending -- it's just a person who knows a particular topic better than me trying to make a gentle introduction.
If someone not only answered my question, but also voluntarily spent another hour telling me all the background stories, I would have nothing but gratitude. Sure, some of those people may not be the nicest person in the world. if you just need a quick answer and be done, you can ask ChatGPT to summarize it.
Not really. If you ask people at watercooler which _shell_ they are using you are getting 20 minutes conversation about whether zsh is better than fish or vice versa. And if you ask same question about _terminal_ it would be mostly about whether their favorite terminal is GPU accelerated and supports ligatures :)
If you can’t get a straight answer at a UNIX site, where can ya get it?
there was nothing condescending about at-least the top few answers ( i didnt go through all of them) and ironically by being snarky here , you are being the very thing you accuse SO of
often, but not always. if someone tells me they made a terminal program to me it means that it can run without any gui. particularly i can run it in tty and without a windowing system. if someone tells me they made a shell program then its much harder for me to assume the above. actually it probably just means a shell script
>Subtle condescension and authoritative declarations
Well maybe we shouldn't ignore the intent of the answer ;)
>SO really does attract misanthropes.
Wow, I think you're reading way to much into this.
SO is a Q&A based knowledge base. Questions are supposed to be somewhat open-ended prompts that inspire experts to write detailed and informative responses. The OP seems to be an excellent example this.
> open ended
I recently tried asking a question like that. Easy but effective optimization techniques for programming languages. Hell I included an answer myself and was going to add more. The result wasn't pretty. While I was typing up a second answer, the question was downvoted, closed, someone welcomed me to the site and then deleted the comment, the answer I included with the post was downvoted not for being wrong but for "enabling" a bad question, I got told to get out and go blog about it instead and then a few days later the entire thing was deleted like worthless spam.
Plural? Obviously that wouldn't be accepted. It should be something that can have a single best answer.
Open-ended that allows an expert to expand and explain doesn't mean free-for-all.
A shell is a UI to the operating system, used for file management, launching programs, etc. Historically it referred to Unix terminology: the kernel was the bit of the OS that actually performed operations, and the shell was a user friendly wrapper around the kernel's system-call interface. Usages drifted, however, and the shell became called upon to do other things, while the one-to-one mapping between shell commands and system calls drifted and was outsourced to external programs (cp, mv, rm, etc.) But the idea that the shell was your UI into system management persisted. Shells can be graphical; Explorer on Windows and Finder on macOS can be considered shells.
TTY stands for Teletype, an early form of terminal called a teletypewriter. Like a normal typewriter, it printed on paper rather than having a screen. For historical reasons, Unix systems have device nodes called /dev/ttyXX to represent terminal connections.
The console is the main user interface to the system. On old mainframes and minis, it was a dedicated terminal sitting in the room the computer was in and wired directly to it. Other terminals could be located in another room, building, or far away and might communicate with the computer via modem or other telecom link. Some administrative functions, such as installing the OS itself, could only be performed via the console. Today, a typical PC's attached monitor(s), keyboard, and pointing device might be considered the console, and might be abstracted as such through e.g., /dev/console, or at a lower level, NetBSD's wscons(4) kernel driver.
You just reminded me of one of the earlier uses of “hacker” in popular culture that I’m aware of - They Live (1988) - one of the vagrant guys in the homeless encampment referred to the interference upon the analog TV broadcast as being the work of a hacker:
https://www.youtube.com/watch?v=1V-4JHT2q3w
This fictional hack may be inspired by actual events from a year earlier:
https://en.wikipedia.org/wiki/Max_Headroom_signal_hijacking
I remember one of the kids in the film Jurassic Park referring to themselves as a hacker, but this time in a positive light. Not sure if that line was in the original book, or if that was an addition for the movie.
… he wrote on a site called Hacker News that is not focussed on unauthorized computer access :)
... $ tty
/dev/tty1 <- that's sorta a modern "tty"
... $ tty
/dev/pts/17 <- that's a pseudo-tty
I like this one:https://unixsheikh.com/articles/the-terminal-the-console-and...
But bash is also a programming language. I couldn't find the talk that you're referring to, but Joe might have been referring to
1. 'using the shell' - as in, interacting with your OS through text, learning POSIX commands (which you could be executing with bash) and the mindset you need for shell usage
2. 'using bash' - as in, using bash as a scripting language
also vim > emacs ;)