Boston Python workshop 2/Friday setup/Terminal navigation on Windows: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Jesstess
(Created page with 'There are two commands that we'll be using at a command prompt to navigate the filesystem on your computer: * <code>dir</code> * <code>cd</code> <code>dir</code> lists the conte…')
 
imported>Jesstess
No edit summary
Line 39: Line 39:
* You can use Tab to auto-complete directory and file names. So from inside the root directory, if you type <code>cd Pytho</code> and hit Tab, the command prompt will auto-complete the directory name, and you can then hit enter to change into the <code>C:\Python27</code> directory.
* You can use Tab to auto-complete directory and file names. So from inside the root directory, if you type <code>cd Pytho</code> and hit Tab, the command prompt will auto-complete the directory name, and you can then hit enter to change into the <code>C:\Python27</code> directory.
* The command prompt maintains a command history. You can use the up arrow to cycle through old commands.
* The command prompt maintains a command history. You can use the up arrow to cycle through old commands.

===Success!===

You've practiced using <code>dir</code> and <code>cd</code> to navigate your computer's filesystem from the command prompt.

Revision as of 19:07, 12 May 2011

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

  • dir
  • cd

dir lists the contents of a directory.
cd 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 cmd 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 cmd into the text box, and hit enter.

Practice using dir and cd

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 C:\ directory.

dir

This lists the contents of the C:\ directory.

cd Python27

This will change you into the Python27 subdirectory of the C:\ directory.

dir

You should see the names of all the files in C:\Python27, including your python.exe application.

cd ..

.. means "parent directory", so this command moved you up to the parent directory. You were in C:\Python27, so now you are in C:\, 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 cd Pytho and hit Tab, the command prompt will auto-complete the directory name, and you can then hit enter to change into the C:\Python27 directory.
  • The command prompt maintains a command history. You can use the up arrow to cycle through old commands.

Success!

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