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


3 Answers 3


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

  • 8
    And if you want to refer to another user home directory you can use ~user, as in ls -l ~enzotib/Documents/.
    – enzotib
    Dec 4, 2011 at 20:05
  • 2
    Actually, ~ is the shorthand for current user's home folder :) Dec 4, 2011 at 20:17
  • 1
    I did not say invalid :) Generally we see ~ instead of ~/, since / is not necessary there. Dec 4, 2011 at 20:47
  • 8
    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, 2011 at 2:41
  • 1
    There's no place like ~
    – Foon
    Mar 22, 2013 at 1:56

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
  • This is a direct result of the fact that /root is listed as the home directory of the root user in your /etc/passwd table. It isn't a special case. Aug 8, 2018 at 0:51

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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