I have often wondered why the ~ (tilde) character represents the home directory of a user.

Is there a reason behind this, or is it just because tilde is an infrequently used character?

  • 89
    WARNING! Never do this mkdir '~' because you will forget escaping this rm -rf ~ (worst day ever)!
    – cprn
    Commented Nov 21, 2015 at 16:40
  • 27
    That is why you should use rmdir. Commented Jul 13, 2016 at 21:36
  • 2
    @cprn I knew a phd student who did that to their thesis. Commented Jan 17, 2023 at 20:42

2 Answers 2


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.

  • 52
    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. Commented Mar 16, 2012 at 15:27
  • 47
    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
    Commented Mar 20, 2012 at 7:15
  • 63
    Incidentally, what is the HERE IS key for?
    – jogloran
    Commented Jan 21, 2013 at 12:36
  • 43
    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: en.wikipedia.org/wiki/Teleprinter#.22Here_is.22_key
    – pbm
    Commented Jan 21, 2013 at 15:53
  • 17
    Is this also the reason why in RegEx, "^" is the start of a string?
    – I.devries
    Commented Feb 15, 2014 at 10:59

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


You must log in to answer this question.

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