Warning: this part is fairly OSX-centric… if you're on windows, let me know, and we can do a separate session.
Definitions (of course)
OSX's directory structure
A little bit about pathnames
First, Some Definitions
Directories
What's a directory (to simplify things, we can use "directory" and "folder" interchangeably)? →
a directory is an organizing structure in your file system; it references other files (and directories)
we can think of it as a thing that contains files
…or because directories can be nested, you can think of your directories and files as a tree! (what a terrible looking tree!?)
Root
root (or just /) is:
the top most directory on a disk
think of it as the root of your tree!
it's the directory that contains all of the other files and directories
Pathnames
What's a pathname? →
a pathname is the general form of the name of a file or directory; it specifies a unique location in a file system
for example, in finder, to locate a file or folder, you follow a particular path - let's check this out →.
what's the path to the Desktop starting from the top most folder, the hard drive (probably Macintosh HD)? →
Let's Look at OSX's Directory Structure
Some Structure
Each operating system organizes their files and directories differently. OSX's file structure looks like this (it's similar to other UNIX based file systems):
/ - (also called root) the top most folder on a disk (the directory that contains all of the other files and directories)
/Applications - where shared applications are kept
/Users - all user accounts and their accompanying files are stored here
/Volumes - all disks that are attached to your computer including USB drives, hard drives, etc.
/System - system specific files, libraries, preferences that are critical to the operating system
More About the User's Directory
It's worth noting the directories nested under Users. They should seem familiar to you.
/Users/username - (also called home when you're in your own username's directory) contains files specific to that particular user
/Users/username/Desktop - represents the user's Desktop
/Users/username/Downloads - the user's downloads folder
And Now… To Pathnames!
What's a Pathname?
A pathname is the general form of the name of a file or directory; it specifies a unique location in a file system.
Path Separator
A path separator is a character that's used to join together each directory in a pathname that contains nested directories (for example, Desktop was located under Users and username… there was a character that separated each directory).
What character represents the path separator on OSX (we just saw this)? →
it's a forward slash, /
(sometimes just called slash when referencing directories)
for windows, the separator is backslash
Absolute vs Relative Paths
absolute paths are paths expressed as starting from root
example: /Users/username/Desktop
relative paths are paths expressed as relative from the current working directory
example (if you're starting from /Users/username): Desktop
Some Special Paths
There are shortcuts to represent specific paths:
~ (tilde) is your home directory
/ (forward slash) is root directory
The following paths are relative to the directory that you're in:
. (dot) is the current directory
.. (dot dot) is the parent directory
../.. (dot dot slash dot dot) is the parent of the parent directory