Boston Python Workshop 6/Friday/Windows terminal navigation

There are two commands that we'll be using at a command prompt to navigate the filesystem on your computer:

lists the contents of a directory.

moves you into a new directory (it stands for "change directory").

Let's practice using these commands.

Open a command prompt:

 * On Windows Vista or Windows 7: click on the Start menu (the Windows logo in the lower left of the screen), type  into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.
 * On Windows XP: click on the Start menu (the Windows logo in the lower left of the screen), click on "Run...", type  into the text box, and hit enter.

Practice using and
Before you practice these commands, let's make sure you are really at a terminal prompt. Recall that a terminal prompt will look like  and a Python prompt will look like. Make sure you are at a terminal prompt and not a Python prompt; if you are at a Python prompt, you can type  on a line by itself and then hit enter to exit Python and return to a terminal prompt. Great!

Type each of these commands and hit enter:

dir This lists all the files in your home directory.

cd C:\ This will change you into the  directory.

dir This lists the contents of the  directory.

cd Python27 This will change you into the  subdirectory of the   directory.

dir You should see the names of all the files in, including your   application.

cd .. means "parent directory", so this command moved you up to the parent directory. You were in, so now you are in  , the root directory.

dir This lists the contents of the root directory, confirming where you are.


 * You can use Tab to auto-complete directory and file names. So from inside the root directory, if you type  and hit Tab, the command prompt will auto-complete the directory name, and you can then hit enter to change into the   directory.
 * The command prompt maintains a command history. You can use the up arrow to cycle through old commands.
 * Note that the text that makes up the command prompt changes as you move around directories. The command prompt will always give the full directory path to your current directory.

Success!
You've practiced using  and   to navigate your computer's filesystem from the command prompt.

&laquo; Back to the Friday setup page