90
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 09 Feb 2024
90 points (94.1% liked)
Linux
48376 readers
1195 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
Actually,
Ctrl+C
is the interrupt hotkey for pretty much every CLI app/terminal on every platform. Try it within the Command Prompt/PowerShell/Windows Terminal, or the macOS terminal - they'll all behave the same.The use of
Ctrl+C
as an interrupt/termination signal has a very long history even predating the old UNIX days and DEC - it goes back to the days of early telecommunications, where control characters were used for controlling the follow of data through telecommunication lines. These control characters, along with regular characters, were transmitted by being encoded in binary, and this encoding scheme was defined by ASCII (American Stanard Code for Information Interchange), published in 1963.In ASCII, the control character
ETX
(meaning end-of-text; represented by the hex code 0x03) was used to indicate "this segment of input is over", or "stop the current processing".Now what does all this have to do with with
Ctrl+C
you ask?For that, you'll need to go back to the days of early keyboards. Keyboards back then generated ASCII codes directly, and when a modifier key (Ctrl/Shift/Meta) on a keyboard was pressed in combination with another key, it modified the signal sent by the keyboard to produce a control character.
Specifically, pressing
Ctrl
with a letter key made the keyboard clear (set to zero) the upper three bits of the binary code of the letter, thus effectively mapping the letter keys to control characters (0x00 - 0x1F: the first 32 characters on the ASCII table).Ctrl+C
clears the upper three bits, resulting in 00000011, which is 0x03 in hex.And would you look at that, 0x03 is the code which represents the control character
ETX
.The use of
ETX
to interrupt a program in digital computers was first adopted by the TOPS-10 OS, which ran on DEC's PDP-10 computer, back in the late 60s. It's successor, TOPS-20 also included it, followed by the RSX-11 (on the PDP-11), and VMS (on the VAX-11).RSX-11 was a very influential OS, created by a team that included David Cutler. It influenced the design of several OSes that followed, such as VMS and Windows NT. Cutler later moved to Microsoft and became the father of Windows NT. Early NT did not include a GUI, so it was natural to adopt existing terminal operation standards, including the use of
ETX
. In fact, NT's internals were so similar to VMS that a lawsuit was in the works, but instead, MS agreed to pay off DEC millions of $$$.Also, when UNIX first came out (1969), it ran on DEC hardware, and so they followed the tradition of using the
ETX
signal to stop programs. This convention flowed to BSD (1978) which was based on UNIX, and NeXTSTEP (1989), which was based on BSD. NeXTSTEP was developed by NeXT Computers, which was founded by Steve Jobs... and the rest is history.Therefore,
Ctrl+C
is something that's deeply rooted in history. You don't just simply change something like that. Sure, you may be able to remap the keybindings, but it's actually hardcoded into many programs so you'll run into inconsistencies - that is, if you used the standard remapping tools built into GNOME/KDE etc.If you want to truly remap Ctrl+C, you'll want to do so at a lower level (evdev layer) so that it's not intercepted by other programs, eg using tools like evremap or keyd. But even then, it's not guaranteed to work everywhere, for instance, if you're inside a VM or using a different OS, or in a remote session. So it's best to remap the keys at the keyboard layer itself, which is possible on many popular mechanical keyboards using customisable firmware like QMK/VIA.
Bravo, very good explanation! As fun fact, i still have at work several DEC ALPHA and OpenVMS servers (some are now VM but we still have physical servers from this era managing our data) and Ctrl+C works well!