Anonymous user
PyCon intro to open source/Windows terminal navigation: Difference between revisions
PyCon intro to open source/Windows terminal navigation (view source)
Revision as of 00:28, 10 April 2014
, 10 years agono edit summary
imported>Jesstess (Created page with "__NOTOC__ 200px The filesystem on your computer is like a tree made up of folders (also called "directories") and files. The filesystem has a...") |
imported>Jesstess No edit summary |
||
Line 7:
We often navigate the filesystem graphically by clicking on graphical folders. We can do the exact same navigation from the command line.
There are
* <code>
* <code>pwd</code>
* <code>cd</code>
<code>
<code>pwd</code> gives the full directory path to your current directory.<br />
<code>cd</code> moves you into a new directory (it stands for "change directory").
===Open a command prompt:===
<b>For this tutorial, we are always going to use Git Bash rather than the Windows cmd program, because Git Bash gives us access to several useful command line utilities.</p>
Start Git Bash either via a shortcut icon on the Desktop, or from your Start menu.
===Practice using <code>dir</code> and <code>cd</code>===▼
(that's an l the letter, not the number 1)
Type each of these commands and hit enter:
<pre>
This lists all the files in your current directory.
<br />
<pre>
This
<br />
<pre>cd /</pre>
This will change you into the <code>
<br />
<pre>ls</pre>
This lists the contents of the <code>/</code> root directory.
<br />
<pre>
This
<br />
<pre>
You should see a list of all the files in <code>/home</code>, including the directory for your username. The directory for your username (e.g. <tt>/home/jessica</tt>) is often called your "home directory".
▲This will change you into the <code>Users</code> subdirectory of the <code>C:\</code> directory.
<br />
<pre>
<br />
<pre>cd ..</pre>
<code>..</code> means "parent directory", so this command moved you up to the parent directory. You were in <code>
<br />
<pre>
This lists the contents of the root directory, confirming where you are.
===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
* The command prompt maintains a command history. You can use the up arrow to cycle through old commands.
===Check your understanding===
Line 71 ⟶ 85:
# After starting a new command line 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>
# 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 command prompt and a Python prompt?
Line 77 ⟶ 91:
===Success!===
You've practiced using <code>
[[File:Champagne.png|100px]][[File:Party.png|125px]]
|