[HN Gopher] What happens when you open a terminal and enter `ls'
       ___________________________________________________________________
        
       What happens when you open a terminal and enter `ls'
        
       Author : alokedesai
       Score  : 72 points
       Date   : 2023-01-11 18:33 UTC (4 hours ago)
        
 (HTM) web link (www.warp.dev)
 (TXT) w3m dump (www.warp.dev)
        
       | proper_elb wrote:
       | Bookmarked! :)
        
       | duckmysick wrote:
       | > ASCII text would be transmitted character-by-character over the
       | wire as the user typed.
       | 
       | How does that work exactly on a lower level, say the current?
       | ASCII text would be decoded to the binary and 1s would be high
       | voltage and 0s would be low? And if there's no data transmitted
       | it would be all low voltage?
        
       | stcroixx wrote:
       | Google asked me this in an interview.
        
         | szgupta wrote:
         | Haha! The post was actually motivated by a common (interview)
         | question: https://github.com/alex/what-happens-when. We thought
         | it would make for a fun adaptation for the terminal world
        
           | amelius wrote:
           | Would you pass this test if instead you answered what would
           | happen if you open a terminal in a made-up operating system
           | and you essentially designed the whole thing in your answer?
        
             | aliqot wrote:
             | I would prefer this answer, it shows an ability to create
             | anew rather than memorize rote.
        
               | anyfoo wrote:
               | Maybe I'm thinking too much of my interviewing
               | capabilities, but I don't think rote memorization applies
               | very much here. When I ask the question, we start out
               | open, let the candidate drive, but ask lots of questions
               | along the way, and at certain points get very detailed on
               | aspects that we care about particularly (while skipping
               | quickly over, for us, uninteresting ones).
               | 
               | If you "rote memorized" both the high level view and the
               | raw details so well that you can freely think and talk
               | about it during the interview, I'd say you'd have to have
               | had some experience as well.
        
             | fragmede wrote:
             | I mean, points for creativity; it just depends on this
             | made-up answer. If you're relying on transistors made up of
             | unicorn farts and gumdrops, and the interviewer has no
             | appreciation for whimsy, that's not gonna go over well.
             | OTOH, if they do, that's bonus points. All I'm saying is
             | that it's a gamble.
        
             | anyfoo wrote:
             | I have asked this question in interviews before, with focus
             | on low level OS aspects. It depends on whether your made-up
             | OS includes the things we care about.
             | 
             | I usually ask the question in an open way, but guide the
             | candidate to "fast forward" past the (for us) boring parts,
             | and focus on the interesting parts we are looking for along
             | the way.
             | 
             | If your OS covers the concepts we are looking for and the
             | answers seem competent, sure, let's give it a try, but
             | don't be surprised if we veer off of that. If the OS is too
             | simple to cover everything (not unlikely for actually
             | existing toy OS projects, I have one myself), we'd want to
             | branch out to those concepts no matter whether you included
             | them in your hypothetical OS or not. And if your made up OS
             | is just too different, it might not apply either.
             | 
             | In other words, ask yourself _why_ this is part of the
             | interview, and that should answer your question: Because
             | you are going to work on a particular OS with particular
             | characteristics.
        
         | plantain wrote:
         | I had the same for SRE @ Google - really simple question that
         | probes the entire free-form depth of your systems
         | understanding.
        
       | crosser wrote:
       | That article starts with too many inaccuracies to recommend it to
       | anybody: - Teletypes were designed about a century before the era
       | of mainframes. - Mechanical teletype did not have an "I/O driver"
       | in it. - OS on Mainframe computers did not have a "Kernel", and
       | neither "I/O driver", "Line discipline" or "TTY driver". This
       | model was introduced with UNIX, the OS that ran on minicomputers.
       | - Was ChatGPT used to write this article? ;)
       | 
       | I've recently stumbled upon an article on the same topic, but
       | containing competent and accurate information, I have a link
       | because I recommended it to a friend:
       | https://thevaluable.dev/guide-terminal-shell-console/
        
       | zokier wrote:
       | One thing that is missing is the termcap/terminfo system. For
       | funsies, you can try to run your session with TERM=dumb to get a
       | retro experience :)
        
       | lordleft wrote:
       | Great article. It's amazing how much ancient tech still pulsates
       | in our sleek new machines.
        
         | szgupta wrote:
         | Thanks! Were there any topics in the blog that you think would
         | benefit from more detail in a follow-up post?
        
           | bkor wrote:
           | Things you might want to add:
           | 
           | a) Escape sequence to set the "dynamic" terminal title
           | 
           | b) how e.g. GNOME notifies you that a long running command
           | has completed
           | 
           | c) how e.g. GNOME asks if you are certain to close a
           | terminal, but only in case you're not in a shell
           | 
           | d) maybe readline or /etc/inputrc
           | 
           | e) bash completions maybe? it's sort of in there already
        
       | imagetic wrote:
       | Nice to see a fun topic on the front page.
        
       | szgupta wrote:
       | Hey HN! I'm Suraj, one of the authors of this blog post. Andy
       | (@acarl005) and I came up with the idea to write this post when
       | we realized there weren't many existing resources on how a
       | terminal works under the hood, end-to-end. If folks find this
       | useful, we'd be happy to turn this into a series and dive deeper
       | into sub-topics. Let us know what you think :)
        
       | ktfth wrote:
       | Awesome content! Very interesting how the process of a tool deal
       | with the wires behind the scenes.
        
         | szgupta wrote:
         | Thanks! It was fun to write this up. Glad you enjoyed :)
        
       | tipalti_layoff wrote:
       | [flagged]
        
       | lloydjones wrote:
       | Excellent article! Thank you
        
       ___________________________________________________________________
       (page generated 2023-01-11 23:00 UTC)