Open Source Comes to Campus/UMD/Laptop setup/OSX command line: Difference between revisions
Content added Content deleted
imported>Jesstess No edit summary |
imported>Jesstess No edit summary |
||
Line 77: | Line 77: | ||
* 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>. |
* 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. |
* You can <tt>cd</tt> to an absolute path from anywhere on the filesystem. |
||
* This is an example absolute path: <tt>/ |
* This is an example absolute path: <tt>/Users/jesstess/projects</tt> |
||
<b>Relative paths</b> |
<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>. |
* 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>/ |
* 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>/Users/jesstess</tt>, then <tt>cd projects</tt> would take you to <tt>/Users/jesstess/projects</tt> assuming that such a directory existed. If you were in <tt>/Users/brad/Desktop</tt>, then <tt>cd projects</tt> would take you to <tt>/Users/brad/Desktop/projects</tt>. |
||
===Tips=== |
===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 |
* You can use Tab to auto-complete directory and file names. So from inside the root directory <tt>/</tt>, if you type <code>cd Us</code> and hit Tab, the command prompt will auto-complete the directory name, and you can then hit enter to change into the <code>/Users</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. |
||
Line 95: | Line 95: | ||
# After starting a new command line prompt, how would you get to the root directory? |
# 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? |
# How do you check what files and directories are in your current working directory? |
||
# If you are in directory <tt>/ |
# If you are in directory <tt>/Users</tt>, and you want to get to <tt>/Users/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 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 <tt>cd projects</tt> and <tt>cd /projects</tt>? |