Home Directory ( ~ )

On Unix and Linux, every user has a "home" directory. This directory is yours and yours alone. The location of your home directory varies depending on which OS you use. For example, on Mac OS it is /Users/<username> but on Ubuntu system, it is /home/<username>.

Finding your home directory is easy. When you first log into your system you will be placed in your home directory by default. With this knowledge, you can use pwd (print working directory ) command to get the path of your home directory.

$ pwd
/Users/robin

Your home directory will be where your settings files get stored and where your desktop is kept. The home directory (or subdirectories under your home directory) is also where you will save documents and files that are yours and not to be shared with others.

By default, your home directory will be unreadable and inaccessible to all other users apart from yourself (and root). You can change these permissions if you want.

It is quite common to see a tilde ( ~ ) in place of the full path for a home directory.

$ ~
-bash: /Users/robin: is a directory

The ~ will expand to be the path of your home directory when you use commands such as cd.

$ cd ~
/Users/robin