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:

pwd
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 The Python 2 Course

When you buy directly from the author, Zed A. Shaw, you'll get a professional quality PDF and hours of HD Video, all DRM-free and yours to download.

$29.99

Buy The Python 2 Course Buy The Python 3 Course Instead

Try a free sample of Learn Python the Hard Way right here, video lectures not included.