3 ms·
If you've ever wondered why it's ctrl+g: https://twitter.com/ViolenceWorks/status/1335382435031252992?t=opHY3wm7MCWz17exckm7vQ&s=19 https://twitter.com/Violenc
by wanderingjew 3y ago
If you've ever wondered why it's ctrl+g:
https://twitter.com/ViolenceWorks/status/1335382435031252992?t=opHY3wm7MCWz17exckm7vQ&s=19 https://twitter.com/ViolenceWorks/status/1335382435031252992...
- Arch485 3y agoThis was super cool - I've always wondered why the bell character exists/why it's ctrl+G.
- snvzz 3y agoCan't open because twitter, but here's own explanation: Control-a inputs byte value 1, control-b 2 and so on. BEL is mapped to value 7 in ascii, thus C-g. Note control-space usually does input a NUL (0) in most terminals.
- blueflow 3y agoProducing ASCII control codes is why the Control code came to be and thats how it got its name: https://en.wikipedia.org/wiki/Control_key#History https://en.wikipedia.org/wiki/Control_key#History
- susam 3y agoAnother way to look at it is that Ctrl+G takes the code (ASCII) of G, i.e., 71 (binary 1000111) and toggles its 7th least significant bit to get 7 (binary 111) and indeed 7 is the code of the BEL character. This explanation is over-simplified though. In practice, different systems have used different techniques to derive control codes from key chords. I have a more detailed article about this at https://susam.net/blog/control-escape-meta-tricks.html https://susam.net/blog/control-escape-meta-tricks.html if anyone is interested to read it.