I have often wondered why the ~ (tilde) represents the home directory of a user. Is there a reason behind this, or is it just some infrequently used character?

  • 19,340
  • 16
  • 43
  • 67
Lelouch Lamperouge
  • 6,859
  • 3
  • 14
  • 11

2 Answers2


Quoting Wikipedia:

On Unix-like operating systems (including BSD, GNU/Linux and Mac OS X), tilde often indicates the current user's home directory: for example, if the current user's home directory is /home/bloggsj, then cd, cd ~, cd /home/bloggsj or cd $HOME are equivalent. This practice derives from the Lear-Siegler ADM-3A terminal in common use during the 1970s, which happened to have the tilde symbol and the word "Home" (for moving the cursor to the upper left) on the same key.

layout of the ADM-3A keyboard

You can find photos of the Lear-Siegler ADM-3A keyboard on this site.

image of an ADM-3A keyboard

This terminal is also the source of the movement commands used in the vi editor: h, j, k, l for left, down, up, right.

Matthias Braun
  • 6,947
  • 6
  • 41
  • 50
  • 23,867
  • 6
  • 35
  • 50
  • 50
    I have also read this is why `Esc` is used to switch modes in `vi`, since the key is easy to reach on this type of keyboard. – Justin Ethier Mar 16 '12 at 15:27
  • 45
    Reading this answer, I just realised why GMail's shortcuts also use 'J' and 'K' for move to previous email and move to next email, respectively! – rigved Mar 20 '12 at 07:15
  • 1
    How neat would it be to have a keyboard like this! – Thomas Ahle Jan 21 '13 at 10:04
  • 3
    @ThomasAhle if your keyboard uses [Cherry-MX keys](http://www.wasdkeyboards.com/index.php/gallery2) then you can do this [quite easily](http://imgur.com/a/oCob1). See also this [reddit thread](http://www.reddit.com/r/vim/comments/zq97e/alright_rvim_win_a_free_vim_keycap_heres_a/) on cherry-mx-vim-keyboard setups. – RJFalconer Jan 21 '13 at 12:21
  • 61
    Incidentally, what is the `HERE IS` key for? – jogloran Jan 21 '13 at 12:36
  • 41
    I'm not sure if it is relevant: `Some teleprinters had a "Here is" key, which transmitted a fixed sequence 20 or 22 characters [...] This was commonly used to identify a station; the operator could press the key to send the station identifier to the other end`. Source: http://en.wikipedia.org/wiki/Teleprinter#.22Here_is.22_key – pbm Jan 21 '13 at 15:53
  • 3
    That's exactly what the "HERE IS" key is for; it would be useful when many terminals share a serial line to the computer. On the ADM-3A, it was an optional addon board for the RAM to store the identification in. Source: http://vt100.net/lsi/adm3a-om/adm3a-om.pdf – aredridel Jan 21 '13 at 17:02
  • 10
    The next question is why the home key selected to have tilde on it. :) – HaL Jan 21 '13 at 17:35
  • And you could really edit fast in Vi on an adm3a. Vim users, it's where it all cameo from.... –  Jan 21 '13 at 19:15
  • 2
    @JustinEthier: like many vim users, I always tweak my settings in order to make "CapsLock" behave like "ESC" ("ScrollLock" is a good candidate for the "CapsLock" funcions). – Paulo Scardine Jan 25 '13 at 20:45
  • The "resting point" and "I-know-where-I-am-without-looking-at-the-keyboard point" for my index finger of the right is the `j` key. This is probably why this moving scheme has always been such a pain to learn for me. – YuppieNetworking Nov 26 '13 at 14:59
  • another interresting tidbit: hjkl : look at the shape of those letters: 'j' has a bit going underneath the line ("goes down"), 'k' has a bit going above the line ("goes up"), and 'l' (L) has a big going to the right. Easy way to remember each letter's respective direction. And then "h" is the symetrical of "l" around the "hj" axis... [it does help to remember the motions, trust me ^^]. I believe that's why those letters were used for the "left,down,up,right" directions. – Olivier Dulac Dec 04 '13 at 17:53
  • 15
    Is this also the reason why in RegEx, "^" is the start of a string? – I.devries Feb 15 '14 at 10:59
  • 6
    @olivier, that is post-facto reasoning. You can't see these features on the keyboard's capital letters anyway. They are the four adjacent home-row letters under the right hand, that's why the arrows are there. Other "classic" keyboards like the VT52 used them this way as well, iirc. (Of course, using I/K for Up/Down, and J/L for right/left, as many console games did, is ergonomically far more convenient.) – alexis Feb 17 '14 at 16:25
  • 1
    @alexis, How would you know it's not pre-facto? – Pacerier Jan 23 '15 at 09:12
  • 3
    @Pacerier, because the QWERTY keyboard layout is about a hundred years older than CRT screens and arrow keys! – alexis Jan 23 '15 at 21:36
  • 2
    @jogloran Yeah, 'Here is' was unusual to see. But have you seen 'RUB' & 'REPEAT' at the bottom? What is 'RUB'? – Alex Stragies Aug 17 '15 at 18:35
  • 3
    @AlexStragies RUB is short for RUBOUT, which was what the Delete key was called on many keyboards of the time. – Barmar Sep 20 '15 at 05:05
  • @JustinEthier according to [image on Wikipedia](https://en.wikipedia.org/wiki/ADM-3A#/media/File:KB_Terminal_ADM3A.svg) Esc was where nowadays Tab usually is. (I'm considering remapping this in my Vim...) – Alois Mahdal Oct 09 '15 at 23:29
  • If you happened to notice a strange influx of upvotes today, it's because you've been featured on Hacker News for the third time: https://hn.algolia.com/?query=why%20was%20chosen%20home%20directory&sort=byPopularity&prefix&page=0&dateRange=all&type=story – vastlysuperiorman Apr 06 '16 at 22:40
  • 5
    Where is the 'any' key? :-) – JS. Apr 27 '16 at 17:04
  • @alexis yes no one in there right mind would invent something as poorly optimised as querty for a CRT (or LCD/OLED/etc) display. Now that we don't have mechanical linkages between keys and printer, there is no need for it. (`',.pyf`) – ctrl-alt-delor Jul 13 '16 at 21:50
  • another clearer example photo can be found in [Why does vim use hjkl for cursor keys?](https://vi.stackexchange.com/a/9329/33998) – phuclv May 05 '21 at 03:39

The Home key was also used for the tilde character on old terminals. See here for more details.

Edd Steel
  • 2,621
  • 1
  • 13
  • 12