7 ms·
A Guide to the Terminal, Console, and Shell
- nullfield 4y agoGood bit of history, and definitely a lot about terminals that I didn’t know, or things that filled in the “why” of some things I did know (^Q/^S for example). Some things that poked me while reading: * varying use of “encrypt” and “encode” for transmitting data; suggest sticking with encode/decode * mention of Intel x87 when I think you probably meant x86
- herpderperator 4y agoYeah, I saw it mentioned encryption and I was like... are you sure? Encryption wasn't commonplace until this past decade with HTTPS finally being widely used.
- Sivart13 4y agothe subject matter is good but the text is riddled with these minor errors that make me distrust the accuracy of any parts that drift out of the knowledge I already have
- thanato0s 4y agoAuthor here. Yeah, my bad. I'm not a native English speaker, and somehow to me the word "encoding" was only used for encoding information on a computer. I was confused when I wanted to say the same thing for telegrams; I began to use "codify", and then "encrypt", which is obviously wrong. I fixed the mistake. Sorry for that.
- bloppe 4y agoCool article! Thanks!
- michaelsbradley 4y agoFor those interested in learning more about terminal emulators and character graphics, checkout Nick Black's book Hacking the Planet (with Notcurses): A Guide to TUIs and Character Graphics[1]. While the overall focus of the book is on programming with Notcurses[2], the author shares a wealth of related info and history throughout its pages. Note also that Notcurses has evolved quite a bit, but the book is still a nice resource. [1] https://nick-black.com/htp-notcurses.pdf https://nick-black.com/htp-notcurses.pdf [2] https://github.com/dankamongmen/notcurses#readme https://github.com/dankamongmen/notcurses#readme
- jdhendrickson 4y agoI bought that book a while ago, and it reminds me of the old days when a lot of the leading lights in the open source community were a bit more of a personality. I enjoyed it, he's obviously incredibly bright and knowledgeable and he makes the subject understandable and fascinating. Until you commented I had never run into another soul that knew about him much less had read the book. Check out his youtube channel it's a wild ride! Good example video from it. https://www.youtube.com/watch?v=fq963c6Fl5E https://www.youtube.com/watch?v=fq963c6Fl5E (I know it sounds like I could be Nick with all this praise but I'm just a guy that appreciates people with interesting obsessions that may benefit me some day).
- still_grokking 4y ago> Check out his youtube channel it's a wild ride! Boy, what did I just see—and especially hear?! But never mind. Still the main question remains regarding this kind of TUI stuff: Why? I see that it's a impressive demo and great hack, sure. But why should we use a glorified virtual line-printer to display all those things? It's just layers of craziness (like I started to call such stuff). In the end our hardware will render pixels! (In big contrast to the original hardware for which this stuff was invented in the first place.) Misusing our glorified virtual line-printers should be finally replaced with something that acknowledges our current reality (which is: HW based on pixel framebuffers) instead of fighting this reality. It's a complete joke that I need a multi-GHz computer and an expensive GPU with many TFLOPs only to be able to scroll somehow "smooth" in an UI form the 60's…
- janvdberg 4y agoThis is great! I’ve been remotely logging into systems for all of my adult life and last week I went on a bit of a bender because I realized didn’t really grasp how these things actually work. I am not sure I do now (specifically how SSH ties in to this). But at least I now know more about terminals, shells, rawmode and ptms/ptx and more. This link right here fits right in with the following ones: [0] https://biriukov.dev/docs/fd-pipe-session-terminal/4-terminals-and-pseudoterminals/ https://biriukov.dev/docs/fd-pipe-session-terminal/4-termina... [1] https://www.sobyte.net/post/2022-05/tty/ https://www.sobyte.net/post/2022-05/tty/ [2] http://www.linusakesson.net/programming/tty/index.php http://www.linusakesson.net/programming/tty/index.php
- Tolexx 4y agoThanks for the links. So many vital information there especially with regards TTY. I had a bit of an issue with it while working with docker sometime thus year. It will be nice to learn more about it.
- pram 4y agoI’ve always wondered: does the carriage return key on an actual teletype machine do CR+LF in one button press? I know these were separate levers on old typewriters, but it seems like the “return” key has always done both.
- blueflow 4y agoIt doesn't. It only sends LF. The tty line discipline patches that up. Edit: LF, not CR, but its not universally like that.
- defrost 4y agoThe Teletype Model 33 ASR keyboard has two seperate keys, one for carriage return, one for line feed [1], [2]. These correspond to the it primarily being a printer with control codes, with keyboards, tape punches and tape readers being additional (in various incarnations of the larger Teletype device family). The codings are distinct to enable overstrike and faster "next line w/out return" mechanical performance. [1] https://en.wikipedia.org/wiki/Teletype_Model_33 https://en.wikipedia.org/wiki/Teletype_Model_33 [2] https://en.wikipedia.org/wiki/File:Mappa_Teletype_ASR-33.jpg https://en.wikipedia.org/wiki/File:Mappa_Teletype_ASR-33.jpg
- ggm 4y agoGrow up with an asr-33 connected to an EMAS system in the basement at home. It was noisy but much less noisy than the card punch and remote entry station it replaced (the joys of a professorial parent who got a 200 baud line to work installed) It had cylindrical keys -then at uni used the same with decwriters and vt52s and subsequently vt100s and adm5. In memory, the adm5 was wonderful. The one in my basement looks at me and says: I whine (flyback transformer) and I shimmer (unstable tube needs a degauss) and I am slow (-really not reliable at 115200 if even capable, which I doubt. I last ran it 9600 attached to a sun workstation serial console) and best of all my keyboard is basically the same as that asr33 and really, really tiresome to use. They're mostly better in memory than in real life. The vt100 and subsequent weren't bad, good enough for people like systime in leeds to clone them (they got done for cloning Vax boards, and selling them behind the iron curtain. The factory is a secret spy headquarters in the original "edge of darkness" TV series) and sell cheaper. The vt240 was pretty good. The blit and subsequent were lovely, but had a brief life as real graphics workstations came up. Really, the depraz mouse made the blit/gnot/jerq worthwhile. The first time I met a terminal device which was not 80x24 was a blit class terminal in ucl-cs. On an ICL (ok. 3 rivers. ICL made it under licence in musselburgh south of edinburgh) Perq I used before then you used a terminal(ish) entry which may also have been not 80x24. The vertically mounted hard disk had a translucent cover and you could see static type sparks coming off the drive hub. really bizarre. It used display memory to compile so your text input window corrupted as you compiled. stty reset/clear fixed it. Having multiple vty on the various BSD on Intel was nice. Vty4 was like steering, behind the scenes or something during the installer, and they launched a debug shell on one. You learned to use stty a lot on old lines. Some were half duplex and some worked like bad antenna at high baudrate and picked up phantom presses in the 50 pair bundle. ASR-33 was upper-case only hence Getty on BSD detecting upper-case only at login and v7 working UC and vi having an UC mode. It got removed from FreeBSD in the 90s. My memory is the xterm implements the ANSI terminal escape codes which are pretty much vt100 because DEC either informed the standards committee decision with a pre implementation or implemented the standard, and MIT had lots of vtxxx series and so used the same to write the escape codes on X so Emacs and vi came along for the ride easily in termcap.
- hackernews1134 4y agoI feel like the author casually states that a video terminal is not a screen without stating why? They are synonyms to me. Can someone enlighten me please?
- arc-in-space 4y agoAs in, the screen is the part that makes it a video terminal, as opposed to the ancient printer terminals. (Also, what do you mean "casually states"? There's a long section detailing the history of the terminal right in the article, am I misunderstanding your question?)
- knorker 4y agoArticle starts of with the incorrect term "virtual shell". If it's supposed to be the character in the story using an incorrect term, I don't think it fits the rest of the article. I feel like this article has been written better before, e.g. in the article's own sources.
- thanato0s 4y agoAuthor here. So the article begins with a story where a character, who doesn't know what he's talking about, try to mentor one of his colleague. It might be awkward though, and difficult to understand; sorry for that. For sure this article was written better by others, but to me they were also lacking some stuff. I never found an article summarizing the whole story; most of the other sources were brushing away too much information for me to understand really why the TTY device had this weird structure. But I guess not everybody will agree... and that's fine :)
- csdvrx 4y agoIt was a very entertaining read, but you may have wanted to include Windows Terminal and xterm. WT is seriously good, and xterm is unrivaled when it comes to compatibility (but WT is progressing fast!) For your next issue, I would suggest talking about pictures in terminals: from the historical sixel to the custom formats like kitty, and maybe connecting them with sixel-tmux Actually, terminal session managers like screen and tmux would be worth another
- deleted 4y ago[deleted]
- highwind 4y agoDid the electric telegraph actual encrypt anything? I thought they were just encoded to Morse code and there was no encryption.
- jonsen 4y agoI think the author is just trying to be smart using 'encrypting' instead of 'encoding'.
- thanato0s 4y agoI didn't try to be smart, I just got super confused what verb to use for telegrams (weirdly enough, to me "encoding" was only used in the context of computer... which is wrong; I tried to use "codify" also, but I'm pretty sure it's also wrong... from there the confusion spread in the whole article). I'm not a native speaker. It doesn't excuse my mistake though.
- still_grokking 4y agoI'm wondering a lot how things would look if we would stop emulating 100 year old tech and build a CLI environment from scratch today. Do some projects in this direction even exist? Or are we going to stick around with abstractions of things even most people's grant great parents haven't ever seen because this tech was already long obsolete at their time?
- tekknolagi 4y agoSee https://arcan-fe.com/ https://arcan-fe.com/, in particular Lash: https://arcan-fe.com/2022/10/15/whipping-up-a-new-shell-lashcat9/ https://arcan-fe.com/2022/10/15/whipping-up-a-new-shell-lash...
- still_grokking 4y agoStill reading, but this looks on first glance very much like something in the right direction. Thanks for the links!
- thanato0s 4y agoLooks super interesting. Thanks!
- still_grokking 4y agoWOW! The architecture is perfect! This looks like the future. It does everything 100% correctly. (Now "only" the rusty Unix commands need to get evolved into some proper interactive language and this would be the perfect CLI.) I'm impressed heavily. Going to install this ASAP to play around with it.
- 0x008 4y agoI wonder what computers would be capable off if we would develop a new stack from the ground up (bits and bytes) with the silicon in mind which we have available today…
- still_grokking 4y ago
- lucasfcosta 4y agoI love these types of guides, especially when they cover pieces under the hood like TTYs. I find that most people who don't use terminals don't do it out of pure preference for GUIs over CLIs. Instead, they use GUIs because they simply don't want to spend time learning how to use CLIs. If they did, I bet 90% of people would move over.
- sbuk 4y agoI started out as a sysadmin on VME, moving to SunOS/Solaris in the mid 90s. I worked largely on DEC VT100 and subsequently a I had a Sun Ultra 5 workstation. I can genuinely argue that I have more real world CLI time under my belt that your average HNer. I have extremely fond memories of that time, but I don’t miss it. I’m much happier with a GUI to click around. I still drop into the terminal to complete some tasks, more out of habit than anything else but the idea of going back to using a terminal 90% of the time just doesn’t fill me with joy. There is a lot of fetishisation of tools, especially of terminals and the CLI. Admittedly things are a better now in someways, in others, not so much.
- velhartice 4y agoWhy should I have to take a computer science course and memorize a whole language to install a program, manipulate files, change a configuration, etc… Not all of us who use computers for a living are programmers. I manage several computers that perform different tasks, but thats only part of my job. Dropping into CLI is something I only need to do a few times a year only because some of the software I use has no other UI. I’ll posit that people like myself use GUIs much easier because they are self learning. I don’t need a CS degree just to use it, all the options are laid before me to see at once. It’s the fastest way for me to do what I want with the software and move on with my life.
- h4n1 4y agoI'm not a programmer either. I just started running Linux out of curiosity, followed a few "copy-paste this into your terminal" guides, eventually got the hang of it and now I do almost everything in it. It both is and isn't "a whole language". Most commands just execute a single program with options and/or arguments, except you don't have the overhead of opening a GUI, finding the right dropdown menu, etc. You quickly start to pick it up like you would a spoken language, remembering the "words" for actions, and it becomes a very natural way to think. IMO the biggest stumbling block is just learning how to type efficiently. This includes knowing about tab completion, history search, putting stuff in your .bashrc and so on.
- jwilk 4y ago> tty - Show the actual controlling terminal No, tty(1) prints the name of the terminal connected to stdin. This is not necessarily the same as the controlling terminal. > who - Show all the users logged in a controlling terminal This is confused too.
- thanato0s 4y agoYeah, I'm a bit confused by the concept of "controlling terminal". As I understand it, in the physical video terminal days, the console connected to the computer was the "controlling terminal", but I'm not sure how this concept translate in the terminal emulator world. So, do you know what's the difference between the "controlling termina" and the "terminal connected to stdin"? I though the terminal connected to stdin was the controlling terminal...
- jwilk 4y agoYou can redirect stdin, but that doesn't disassociate the process from the controlling terminal: $ tty /dev/pts/1 $ tty < /dev/null not a tty $ ps -q $$ -o tty= < /dev/null pts/1 The other file descriptors referring to the terminal don't matter either: $ sh -c 'pid=$$; tty=$(ps -q $pid -o tty=); echo "$tty" > /dev/tty' <&- >&- 2>&- pts/1
- tfe__ 4y agoJust here to tell that there is a message "TODO: Add a screenshot of the login screen!" in the article. Thanks for it, it was really interesting btw.
- thanato0s 4y agoThanks! I got rid of it. Glad you liked the article!
- euroderf 4y agoFS file separator, GS group separator, RS record separator, US unit separator. Did anyone ever find a good way to use these in the terminal ?
- ykonstant 4y agoI use them all the time, in their original meaning. What's important about those bytes is that they are part of the POSIX non-portable ASCII character set, and thus can safely separate objects whose contents come from the portable character set. My shell library uses them to pass portable data around in groups of records, to parse and modify portable filenames, to construct shell commands and scripts automatically and to prepare plaintext data chunks for binary encoding and processing.
- irq-1 4y agoSounds interesting; whats your shell library? Also, do you know of editors that make use of the separators?
- ykonstant 4y agoIt is a personal project, not publicly available. I don't know of plaintext editors making use of the separators by default, because they are not considered plain-text in the POSIX sense (although this leads to some tedious semantic debates that I am profoundly disinterested in).
- ReallyOldLurker 4y agoJust started reading the article, it looks nice! In this sentence: It’s a 7 bits codes, allowing to send bigger messages than with the Baudot (or the Murray) code, even including the luxe of lowercase and uppercase letters. I think "luxe" is really "luxury"?
- cipixul 4y agoIf the tty is a file in /dev, is there a way to monitor a user that logged in by watching their tty? I remember in freebsd it's possible but not sure if possible in Linux...