Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why is ctrl-C the shortcut for "terminate", anyway? I would have expected it to be something like ctrl-T.


from wikipedia (https://en.wikipedia.org/wiki/Control-C):

As many keyboards and computer terminals once directly generated ASCII code, the choice of control-C overlapped with the ASCII end-of-text character. This character has a numerical value of three, as "C" is the third letter of the alphabet. It was chosen to cause an interrupt as it is otherwise unlikely to be part of a program's interactive interface. Many other control codes, such as control-D for the end-of-transmission character, do not generate signals and are occasionally used to control a program.

Also see https://en.wikipedia.org/wiki/C0_and_C1_control_codes#STX


Type

   man ascii
and notice what is 0x40 less than the capital letter.

H is 0x48, backspace is 0x08. ^H is the same as backspace.

I is 0x49, tab is 0x09, ^I is the tab sequence.

Now you know why Windows \r in text file show up as ^M in vi and Emacs.

^D is ASCII 0x04, "EOT (end of transmission)". That's why you use that to end input.

^C is ASCII 0x03, whose name is "ETX (end of text)". That seems a reasonable choice.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: