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

no edit summary
imported>Jesstess
No edit summary
imported>Jesstess
No edit summary
 
Line 68:
<pre>ls</pre>
This lists the contents of the root directory, confirming where you are.
 
<br />
 
===Absolute v. relative paths===
 
When navigating the filesystem, you can use 2 kinds of paths: absolute and relative.
 
<b>Absolute paths</b>
* An absolute path contains the full set of directories from the root of the file system up to your target file or directory. On OS X, an absolute path starts with <tt>/</tt>.
* You can <tt>cd</tt> to an absolute path from anywhere on the filesystem.
* This is an example absolute path: <tt>/home/jesstess/projects</tt>
 
<b>Relative paths</b>
* A relative path is calculated relative to your "current working directory" -- the directory you are currently in at a command prompt, as displayed by <tt>pwd</tt>.
* This is an example relative path: <tt>projects</tt>. That path only has meaning given a current working directory. If your current working directory were <tt>/home/jesstess</tt>, then <tt>cd projects</tt> would take you to <tt>/home/jesstess/projects</tt> assuming that such a directory existed. If you were in <tt>/home/brad/Desktop</tt>, then <tt>cd projects</tt> would take you to <tt>/home/brad/Desktop/projects</tt>.
 
===Tips===
Line 98 ⟶ 83:
# If you are in directory <tt>/home</tt>, and you want to get to <tt>/home/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 <tt>cd projects</tt> and <tt>cd /projects</tt>?
# What is the difference between a command prompt and a Python prompt?
 
Anonymous user