~
by itself is equivalent to $HOME
. It refers to your home directory, typically something like /home/yourname
.
~foo
refers to the home directory of the user foo
.
Both these uses of ~
are handled by the shell. That means, for example, that if you call fopen("~/foo/file.txt", "r")
in a C program, it won't expand ~
to your home directory; rather, it will look for (and probably not find) a directory literally named ~
in the current directory.
/
is the root directory.
Invoking cd
with no argument is equivalent to cd ~
or cd $HOME
.