We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Home

In a Unix-like operating system, a user's home directory is the directory where their personal files are stored. It is also the directory that a user starts in when logging into the system.

I recommend doing all of your development work in your home directory. For example, I like to create a workspace directory in my home directory, and all my programming projects live in subdirectories there.

Danger

Your home directory is where you want to spend most of your time. Many of the other directories on your machine are critical to the operating system or other programs. Be careful when working in other directories like /bin, /etc, /var, etc.

You can mess up your system if you're not careful.

The $HOME Variable

The $HOME environment variable contains the absolute path to your home directory:

echo $HOME

My home directory (on Mac) is located at /Users/wagslane.

The ~ Alias

The ~ character is an alias for your home directory. So when I want to go home, I don't have to type out cd /Users/wagslane or cd $HOME, I can just type:

cd ~