Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to Linux and Ubuntu. People keep using ~/filename in their answers to my questions. What does ~/ mean?

share|improve this question
up vote 32 down vote accepted

~/ is shorthand for the current user's home folder. So if your user name is "foobar" it expands to /home/foobar/

share|improve this answer
And if you want to refer to another user home directory you can use ~user, as in ls -l ~enzotib/Documents/. – enzotib Dec 4 '11 at 20:05
Actually, ~ is the shorthand for current user's home folder :) – heartsmagic Dec 4 '11 at 20:17
I did not say invalid :) Generally we see ~ instead of ~/, since / is not necessary there. – heartsmagic Dec 4 '11 at 20:47
This is only usually correct, but not technically correct. ~ actually expands to the value of the environment variable HOME. If you change the value of HOME, ~ will also no longer point to that user's home directory. – kojiro Dec 5 '11 at 2:41
There's no place like ~ – Foon Mar 22 '13 at 1:56

In general the tilde ~ represents your home folder. Use it to refer to your home directory at the command line.

share|improve this answer

An important thing is, if you are using the root user, ~/ will be the /root directory, not /home/user_name.

In this case, do:

> cd ~/ ; pwd ;

It will exit:

> /root
share|improve this answer

Your Answer


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.