12

I've been told to go to ~/.ssh and, actually, I did cd ~/.ssh and I got into it.

However, I'm wondering: what does the ~ mean in this context?

25

~ = $HOME = your home directory

The next commands will change to your home directory /home/david if your username is david:

cd
cd ~
cd $HOME
cd /home/david
cd ~david
|improve this answer|||||
  • 5
    "change your home directory" -> "make the home directory the present work directory" – steabert Mar 28 '11 at 12:47
  • also, typing cd will get you into your homefolder. – Bart De Vos Mar 28 '11 at 16:14
9

You can also use ~username (no slash) to have it lookup the home directory of a user; that is, ~khamer resolves to /home/khamer, whereas ~david would resolve to /home/david regardless of who is typing the command.

|improve this answer|||||
0

If you type:

cd ~/

and hit TAB, the command should change to the actual path to your home folder. As far as I know, this works with pretty much any command that takes a path as an argument.

|improve this answer|||||

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.