Monday, 9:00–10:30: Getting to know your OS: file and directory system (Mac)
[Introduction; verify that everyone’s Internet connections work]
File system hierarchy
- What are files?
- What are directories/repositories/folders?
- What are programs?
- GUI file explorers and file hierarchy
/
as the center of the filesystem universe (exception: Windows)- Directories are a special kind of file
/dev/null
: the black hole of the file system- Finding the filesystem location of a file from the MacOS Finder or Windows Explorer: Drag the filename from a Finder windows and drop it in a terminal window to paste the path to the file. Or just view the filename by selecting the file and
Cmd+i
(get info).
Configuring your machine to show hidden files
- Mac OS Sierra: Open Finder and hit
Cmd+Shift+.
Do the same thing to turn off hidden files. - Mac OS El Capitan: Open the command line and execute
defaults write com.apple.finder AppleShowAllFiles YES
(orNO
); restart Finder whenever you change this
Configuring your machine to show filename extensions
- Open Finder and select Preferences, click “Advanced”, and check the box next to “Show all filename extensions”.
About files
- Why are some files hidden?
- Case sensitive vs case preserving: Linux is case sensitive, meaning files with the same name but different capitalization are different files (e.g.,
finalpaper.txt
is different thanFinalPaper.txt
). Mac OS and Windows are case preserving, but not case sensitive. - Spaces in a file and directory names. Why could these be problematic?
File ownership and permissions
ls -l
- user, group, other
chown
(You probably can’t change ownership on shared systems and don’t need to do it on your own machine. This command is useful if you install something incorrectly.)chmod
(“644”, “664” for files; “755”, “775” for directories)
Launching a terminal
- The Terminal.app that you will find in the Applications → Utilities folder. (Many Mac users prefer the free third-party https://www.iterm2.com/.)
- For Ubuntu Desktop (Unity): you can hit Ctrl-Alt-T or you can type
Terminal
into the Search box.
Moving through a filesystem
- Navigate up and down, with emphasis on the paths in the title bar
cd
: change directoryls
: list all files
File/directory path in file explorer GUI vs. shell
- Matching the GUI file path with the file/directory path in the terminal
- User-specific directories: where are your home directory, document folder, and desktop? What are their full file/directory paths?
- Non-English OS’s may have translation/localization applied, but only on the GUI side! Why is this?
External drives and mounting
How removable and external drives (such as a USB thumbdrive) are treated in GUI vs. terminal environment
- In Mac OS, they are mounted underneath
/Volumes
when you plug them in. Unmount them by following the instructions at Mount and unmount drives from the command line in Mac OS X.
How to run a program as an administrator
- The GUI will generally ask you if you need to do this
- On the command line, precede the command with
sudo
.