Exercise 3: If You Get Lost

As you go through these instructions you may get lost. You may not know where you are or where a file is and have no idea how to continue. To solve this problem I am going to teach you the commands to type to stop being lost.

Whenever you get lost, it is most likely because you were typing commands and have no idea where you've ended up. What you should do is type pwd to print your current directory. This tells you where you are.

The next thing is you need to have a way of getting back to where you are safe, your home. To do this type cd ~ and you are back in your home.

This means if you get lost at any time type:

cd ~

The first command pwd tells you where you are. The second command cd ~ takes you home so you can try again.

Do This

Right now figure out where you are, and then go home using pwd and cd ~. This will make sure you are always in the right place.

You Learned This

How to get back to your home if you ever get lost.

Buy Learn Python the Hard Way, 5th Edition

When you buy Learn Python the Hard Way, 5th Edition directly from the author, Zed A. Shaw, you'll get access to the digital content for all 60 exercises, plus all 60+ videos that are normally sold separately. You'll also have access to direct help from Zed via Discord chat and live streams on special topics when I have time.


Buy Learn Python The Hard Way, 5th Edition

Learn JavaScript the Hard Way

If you want to learn to be a Web Developer then my new Learn JavaScript the Hard Way course is a great choice. It's currently out as an Early Access release and already has more content than the Python Course, with even more content coming at a 80% discount from the final price.

Buy Learn JavaScript the Hard Way