In both Linux and Windows CTRL + C has two very different meanings, depending on what program you use. In some programs (mostly GUI programs) it means "copy" whereas in other programs (almost all command line tools) it means "interrupt" or "exit".

This is especially troublesome for people moving from using GUI to using command line, since "copy" is a completely safe operation, whereas the interrupt might kill the program you are currently using, thereby potentially destroying your work.

What is the reason, or where is the origin of that divide?

  • Partly-relevant UX discussion: ux.stackexchange.com/questions/86877/… – dhag Nov 25 '15 at 14:21
  • For origin part, you can read Control-C Wikipedia entry. – narendra-choudhary Nov 25 '15 at 14:22
  • If you're afraid to use CTRL+C, you can use CTRL+INSERT which is a widely supported alternative. – Dmitry Grigoryev Nov 25 '15 at 14:46
  • Thanks for these additions! @DmitryGrigoryev Not so much afraid as that it happens to me all the time that I use CTRL+C automatically when I try to copy something out of a terminal window ;) – Dakkaron Nov 26 '15 at 14:12

The “kill” meaning of Ctrl+C is very old, I think even older than Unix. Wikipedia traces it back to TOPS-10, which would date it from the late 1960s. The article explains why Ctrl+C was a reasonable choice: in ASCII, which was published in 1963, the corresponding character is ETX, end-of-text. Lacking a character meaning “stop”¹, a character meaning “this segment of input is over” was a reasonable choice to mean “stop the current processing”.

The “copy” meaning of Ctrl+C comes from Xerox PARC, the inventors of copy-paste in its modern form (and most other fundamentals of graphical user interfaces). I don't know exactly when that was, but it must have been the late 1970s. This thread on User Experience Stack Exchange discusses the choice of key bindings; C for copy makes a lot of sense.

There was little reason for PARC to reject Ctrl+C for copy on the basis of the existing meaning in TOPS-10 and Unix terminals. Operating systems and applications were more diverse then, and far fewer people used computers; there was no opportunity nor call for a single standard for key bindings across all applications. Other uses for Ctrl+C in popular applications include page-down in WordStar² and mode-specific command in Emacs. All of these were designed independently, for applications with often different requirements, running in different environments.

You can configure the terminal key bindings with the stty command. The terminal bindings are active when the terminal is in cooked mode³. For example the command stty intr ^G sets the character that sends a SIGINT signal to Ctrl+G instead of Ctrl+C. The ^G character is BEL in ASCII; when sent to a terminal, it means “ring the bell”. It's the character that Emacs uses for “interrupt the current operation” (rationale: the application sends BEL to the user via the terminal to interrupt the user; the user sends BEL to the application via the terminal to interrupt the application). It doesn't have a standard meaning when sent to a terminal.

Most shells provide line editing features, so they set the terminal to raw mode. So do full-screen text mode applications. You may need to configure these applications to recognize Ctrl+G instead of Ctrl+C, and some may have non-configurable key bindings. So changing the interrupt character may or may not be practically doable depending on which applications you use.

Another approach could be to configure your terminal to change the byte sequence that it sends for the Ctrl+C keychord, or make it send nothing and instead perform a copy operation. You would also choose a different keychord to send Ctrl+C (if you have a non-laptop PC keyboard, you could use the out-of-the-way Pause/Break key). Not all terminals can be configured in this way.

¹ Ctrl-S (XOFF) means stop, but it's addressed to the terminal, not to the application.
² Next to Ctrl+X for next-line, with Ctrl+E and Ctrl+R for previous-line and page-up; these keys were chosen due to their placement on a QWERTY keyboard.
³ Nitpick: cooked mode is a set of terminal settings, including the interpretation of several characters including one that sends an interrupt signal.

  • Amazing answer. Wish I could award a bounty less than 48 hours before the question was asked. – Mikel Nov 26 '15 at 4:43
  • Thanks for that great answer! This is what I like about unix.stackexchange. You can ask about the historical reasons for stuff. If I asked a question like this on stackoverflow it would probably get closed. – Dakkaron Nov 26 '15 at 14:13
  • So it's basically that CTRL+C has had different meanings for GUI and for Command Line way before both of these got merged under a singe OS? – Dakkaron Nov 26 '15 at 14:14
  • @Mikel Thank you, but please keep your bounties for posts that deserve them. I don't feel that this particular question is particularly important or this particular answer is particularly researched or insightful. – Gilles Nov 27 '15 at 13:38
  • @Dakkaron It isn't exactly command line vs GUI, but yes, these meanings arose independently, and each makes sense in its own way. With only 26 letters and far more than 26 things you can do with a computer, there are bound to be clashes. – Gilles Nov 27 '15 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.