Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 699 down vote accepted

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.

Photo of Lear-Siegler ADM-3A keyboard you can find on this site.

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

share|improve this answer
153  
I appreciate the extra info on vi.. thanks –  Lelouch Lamperouge Mar 15 '12 at 0:18
23  
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
27  
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 7:15
24  
Incidentally, what is the HERE IS key for? –  jogloran Jan 21 '13 at 12:36
18  
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 Jan 21 '13 at 15:53

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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