Boston Python Workshop 8/Friday/Linux terminal navigation: Difference between revisions

no edit summary
imported>Jesstess
No edit summary
imported>Jesstess
No edit summary
 
Line 22:
===Open a terminal===
 
You can find the Terminal application throughat SpotlightApplications/Accessories/Terminal, or navigateit tomay Applications/Utilities/Terminalalready be on your menu bar.
 
===Practice using <code>ls</code>, <code>pwd</code>, and <code>cd</code>===
 
(that's an l the letter, not the number 1)
 
Line 49 ⟶ 50:
<br />
 
<pre>cd Usershome</pre>
This will change you into the <code>Usershome</code> subdirectory of the <code>/</code> root directory.
 
<br />
 
<pre>ls</pre>
You should see a list of all the files in <code>/Usershome</code>, including the directory for your username. The directory for your username (e.g. <tt>/Usershome/Jessicajessica</tt>) is often called your "home directory".
 
<br />
 
<pre>pwd</pre>
This displays the full directory path to your current directory, <code>/Usershome</code>.
 
<br />
 
<pre>cd ..</pre>
<code>..</code> means "parent directory", so this command moved you up to the parent directory. You were in <code>/Usershome</code>, so now you are in <code>/</code>, the root directory.
 
<br />
Line 74 ⟶ 75:
===Tips===
 
* You can use Tab to auto-complete directory and file names. So from inside the root directory <tt>/</tt>, if you type <code>cd Usho</code> and hit Tab, the terminal will auto-complete the directory name, and you can then hit enter to change into the <code>/Usershome</code> directory.
* The terminal maintains a command history. You can use the up arrow to cycle through old commands.
 
Line 84 ⟶ 85:
# After starting a new terminal prompt, how would you get to the root directory?
# How do you check what files and directories are in your current working directory?
# If you are in directory <tt>/Usershome</tt>, and you want to get to <tt>/Usershome/jesstess/projects</tt>, how would you do that?
# What are 2 ways to avoid typing out a full navigation command? (hint: one requires that you've run the command before)
# What is the difference between a terminal prompt and a Python prompt?
Anonymous user