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!

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 and Deleting Files

Getting back to the home directory

So in the video, Jim shows that you can get back into the home directory by using cd .. or cd ~, however I found that if you just type cd and press enter it does the same thing. Is there a reason you should use cd .. or cd ~ over just cd?

1 Answer

Shawn Boyd
Shawn Boyd
14,345 Points

'cd' alone does do the same thing as 'cd ~' but not 'cd ..'. 'cd ..' moves you up one directory which, depending on where you are, may or may not land you in your home. There are many ways to get back to your home directory - 'cd', 'cd ~', 'cd ~/', 'cd $HOME', etc. . I would expect the reason 'cd' by itself wasn't taught in this lesson was a pedagogical decision. It's more clear to introduce it as always taking an argument and include exceptions further on.