18

I started using the Linux console a long time ago but I never questioned myself about the circumflex aka caret character (^). I'd like to ask why it's used as a replacement for the word Ctrl.

I thought about it the other day while I was using nano and I also searched to see if there were some answers on internet but what I found was only questions on "what it is" and "what it represents".

Are there some historical reasons? Or does it come from some strange convention?

2
  • 2
    Even the original vi (at least the one in SunOS 3.5) used a caret/circumflex in front of letters to reprecents ctrl-C, ctrl-V, etc. stty did and does that, too. On the other hand, ^ worked as a synonym for | in shell scripts during that era, so you'd always have to backslash the caret in stty invocations. Good question.
    – user732
    Feb 23, 2016 at 15:39
  • 1
    If I had to guess, I'd say that it might have something to do with the fact that Shift, Control, and Meta (as well as their lesser-known ilk such as Super and Hyper) are all modifier keys, of which Control is probably the most-commonly used. Since most characters' Shifted versions can simply be typed, (e. g. 3 / #), ^ might be a visual shorthand for a a different sort of 'shift', so to speak. The fact that for most typable keys/characters, Ctrl just turns off the 64 bit of the character may also be related - ^ being shorthand for NOT (0x40).
    – DopeGhoti
    Feb 23, 2016 at 17:58

1 Answer 1

11

The circumflex (^) was equated to the up-arrow character on teleprinters. By the time SunOS and so forth came around, this part was more than 10 years in the past. The same character (replacement) was used in mathematical expressions, e.g., ^ for powers (where some others might use **). It was also used in Pascal to indicate pointers.

Used for indicating control characters, this dates (at least) before 1980. You can find it used in DEC documentation for instance (it was certainly in use by the mid-1970s when I used teco. The Utilities manual from 1973 (page 927) shows a controlC for instance.

Looking for a suitable source, I find Teletypewriter Communication Codes by Gil Smith which says enough to place this in the late 1960s (demonstrating that the origin is pre-Unix, as well):

ASCII-63 was mostly identical to the current ASCII-67 version. The definitions of the control characters (col-1 above) varied between the two versions, as defined below. Also, in ASCII-63, the upper 32 positions (col-4) were undefined, except for three: RUB (0x7F), ACK (0x7C), and ESC (0x7E). There are inconsistent references to an ALT-MODE char (0x7D) in ASCII-63. In the 1967 version, RUB became DEL and stayed in the same position, but ACK and ESC moved into the control character area (col-1). In ASCII-67, ^ replaced the up-arrow symbol, and _ replaced the left-arrow

ASCII-63 and ASCII-67 are the common variants of ASCII, but there appear to have been some transitional versions as well: in the Teletype Model 33 manual, there are references to a 1965 version of ASCII, that had SS in place of SUB (0x1A), \ for @ (0x40), ~ for \ (0x5C), an odd character in place of | (0x7C), and | for ~ (0x7E). A Teletype code card for M33 and M35 machines indicates a 1966 version of ASCII, though the printable characters shown on the card were identical in all versions.

This used to be well-known, due to the problems of interchanging files between different encodings such as ASCII and EBCDIC where there were still printers capable of rendering up-arrows as such long after the character no longer existed in ASCII.

4
  • 1
    0x5e being an up-arrow before being ^ also explains why that character was used as the pipe operator in the original Unix shell (conveys the idea of data flowing from one command to another). The Bourne shell still treats ^ as an alternative pipe operator (I suppose for backward compatibility with the Thomson shell). Feb 23, 2016 at 21:56
  • yes - uparrows were too useful to let go of, with ASCII. This also reminds me of some more direct keyboard tie-in, but I found no picture to illustrate. Feb 23, 2016 at 22:02
  • 1
    0x9 (TAB) is usually represented as ^I, 0x89 as M-^I, 0xc9 as M-I, 0xe9 as M-i. Do you now if some character has ever been used to represent Meta in place of M-? Feb 23, 2016 at 22:11
  • Not offhand: I didn't pay much attention to super/meta/hyper because when they were introduced, they only applied to a few terminals that most never saw. Feb 23, 2016 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .