Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Getting Started with the Console Moving Around the Filesystem

Why does cd $HOME take you to the home directory? I don't remember seeing that in the video.

Also, will " cd ~ " take you to the home directory? Because ~ is the same as /home/treehouse. Also will cd /home take you to the home directory? Is it an absolute or relative path?

OK so I went back and re-did the quiz and found out that cd /home will not take you to the home directory. I guess that's because the home directory is /home/treehouse, and /home is one level above that. But is /home is not your home directory, then what is it?

2 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

/home is where the "home" directory for all registered users of the system reside. On a typical *nix installation, if you were to ls /home in a terminal you will see folder names of all the registered users.

$HOME is an environment variable that is set when you log in to the os. This is set to /home/your-username. On a typical *nix installation, in a terminal if you were to simply type $HOME the result would be /home/your-username.

In conclusion, /home is the container directory for users' $HOME directory. $HOME is unique for each user by being set to /home/user.

Thank you!