Paths and Review

Definitions

Define the following terms, and give an example of each.

Definitions Continued

OSX Directory Structure

What is the top most folder on a disk (the directory that contains all of the other files and directories) called?

root or /

What is the full path to the student user’s “Home” folder?

/Users/student or ~

OSX Directory Structure

What is the full path to the student user’s “Desktop”?

/Users/student/Desktop

What directory contains all of the disks (USB drives, SSDs, etc.) that are attached to your computer?

/Volumes

OSX Directory Structure Continued

Within the User’s Directory

List all of the commands that we know as well as what they do… →

About ls

Does ls take any arguments or flags? If so, what are they? →

About mkdir

Does mkdir take any arguments or flags? If so, what are they? →

Some Special Symbols for Paths

Name some special symbols that we know for paths… like current directory or home. →

 . (dot) - the current directory
 ..  (dot dot) - up one directory (parent directory)
 ../..  (dot dot slash dot dot)  - up two directories
 /  (slash) - root directory
 ~ (tilde) - home directory
 - (dash) - directory you were previously in

Making Things Easier…

Name some special keys that we use to reduce the amount of typing that we have to do. →

Activity: Drills!

Entering commands flash cards x 3 (use set 1)

We’ll do this together, then try downloading it yourself:

  1. Download drills.py to the home directory
  2. Type python drills.py
  3. When prompted for a number, enter 1
  4. CTRL-C quits

More About Paths

root

Absolute Paths

Absolute paths are paths expressed as starting from root.

You can reference an absolute path regardless of what directory you’re in.

You can reference an absolute path regardless of what directory you’re in

Relative Paths

Relative paths are paths expressed as relative from the current working directory.

For example… if you’re in /Users

You have to be in the directory that you’re assuming to be current for this to work.

Remember - at the prompt, you’re running commands in the context of some location (think folder/directory) on your computer

What Was That Again?

Absolute vs Relative Paths

Macintosh HD			USBDRIVE1			USBDRIVE2		

How would you change directory so that you’re in USBDRIVE1 by using an absolute path? What about relative?

Absolute vs Relative Paths

How would you change directory so that you’re in USBDRIVE2 instead? Do this with an absolute path, and again with a relative path.

Absolute vs Relative Paths

List the different ways to get to your Downloads folder with one command.

Lab

Paths and Review

Output, Download and Uncompress