Editing Windows terminal navigation

From CommunityData

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 7: Line 7:
We often navigate the filesystem graphically by clicking on graphical folders. We can do the exact same navigation from the terminal.
We often navigate the filesystem graphically by clicking on graphical folders. We can do the exact same navigation from the terminal.


There are two commands that we'll be using in the PowerShell terminal to navigate the filesystem on your computer:
There are two commands that we'll be using in a terminal to navigate the filesystem on your computer:
* <code>ls</code>
* <code>ls</code> in PowerShell; <code>dir</code> in <code>cmd.exe</code>
* <code>cd</code>
* <code>cd</code>


<code>ls</code> '''l'''i'''s'''ts the contents of a directory.<br />
<code>ls</code> (<code>dir</code>) lists the contents of a directory.<br />
<code>cd</code> moves you into a new directory (it stands for "'''c'''hange '''d'''irectory").
<code>cd</code> moves you into a new directory (it stands for "change directory").


<b>Let's practice using these commands!</b>
<b>Let's practice using these commands!</b>
Line 18: Line 18:
===Open a terminal===
===Open a terminal===


* On Windows 7/8/8.1/10: click on the Start menu (the Windows logo in the lower left corner of the screen) or press the Windows key to open the Start menu, type <code>PowerShell</code> into the Search field directly above the Start menu button, and click on "PowerShell" in the search results above the Search field. (Alternately, you can just type <code>Powershell</code> without selecting the search box, and you'll immediately switch to the search interface.)
* On Windows Vista/7/8/8.1: click on the Start menu (the Windows logo in the lower left of the screen), type <code>PowerShell</code> into the Search field directly above the Start menu button, and click on "PowerShell" 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 <code>cmd</code> into the text box, and hit enter.


===Practice using <code>ls</code> and <code>cd</code>===
===Practice using <code>ls</code> and <code>cd</code>===
Line 25: Line 26:


<pre>ls</pre>
<pre>ls</pre>
This lists all the files in your current directory, which should be your home directory (something like C:/Users/YOURNAME)
This lists all the files in your current directory.


<br />
<br />
Line 56: Line 57:
<pre>ls</pre>
<pre>ls</pre>
This lists the contents of the root directory, confirming where you are.
This lists the contents of the root directory, confirming where you are.
If you want to get back to your home directory, you can do:
<pre>cd Users</pre>
<pre>cd YOURNAME</pre>
where YOURNAME is the name of your User directory.
One helpful tip is that you can start typing a directory, then hit the <code>TAB</code> key and the terminal will autocomplete it.


===Tips===
===Tips===
Line 75: Line 66:
===Check your understanding===
===Check your understanding===


Answer these questions. Experiment at the terminal prompt if you need to! If you aren't sure about an answer, ask a mentor.
Answer these questions. Experiment at the terminal prompt if you need to! If you aren't sure about an answer, ask a helper.


# What directory are you in after starting a new terminal prompt?
# What directory are you in after starting a new terminal prompt?
Line 89: Line 80:


[[File:Champagne.png|100px]][[File:Party.png|125px]]
[[File:Champagne.png|100px]][[File:Party.png|125px]]
[[Category:CDSW]][[Category:Shared Pages]]
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)