Class 2A. Introduction to the File System, and the Terminal (Command line)#
Lecture Outline#
1. Announcements (5 mins)
2. The File System (20 mins)
3. The Command Line (45 mins)
Part 1. Announcements (5 mins)#
Lab 1 will be due Wednesday January 18, 2023 at 6 PM
My office hours will be for 60 minutes after class on Mondays in EME 0050 and Fridays from 1-2 PM via Zoom. You can also ask for help anytime on Ed Discussion, as well as visiting any of the labs.
Lab sessions start this week, and will not be recorded.
Here are some keyboard shortcuts in VS Code to do some cool things:
Action |
Shortcut on Mac |
Shortcut on Windows |
---|---|---|
Insert additional cursor |
Option + Click |
Alt + Click |
Insert cursor at end of each selected line |
Shift + Option + I |
Shift + Alt + I |
Select all occurrences of current selection |
Shift + Cmd + L |
Shift + Ctrl + L |
Select all occurrences of current word |
Cmd + F2 |
Ctrl + F2 |
Add selection to next Find match |
Cmd + D |
Ctrl + D |
Select current Line |
Cmd + L |
Ctrl + L |
There are dozens more shortcuts, you can find the shortcuts here for:
Part 2. File System (30 mins)#
The file system organizes data on a device as a hierarchy of directories and files (like a tree). Each folder (AKA directory) has a name and can contain any number of files or subdirectories. Each file has a name. The user can change (navigate) directories in the hierarchy.
File System Root - Children and Parents#
The tree is rooted at, well, the root.
There is only one root of a directory hierarchy. Every item in the tree is either a file or a directory (AKA folder).
You can think of a directory as a container that may contains files and/or other directories.
Files on the other hand hold information (and cannot contain other files or directories) .
If directoryC
is contained in directoryP
, then directoryC
is a child of directoryP
and directoryP
is said to be the parent to directoryC
.
A directory may have many children, but can only have one parent.
Absolute versus Relative Path#
The root of the file system is the directory “/”
There is only one root of a directory hierarchy.
A path to a new location (from your current location) can be specified as an absolute path from the root (this will work no matter where we are in the file system):
Activity: Let’s try to re-create that directory and file structure#
You will need the following commands:
cd
: change directorypwd
: print working directorymkdir
: make directoryls
: list directory contentstouch
: create an empty file with a specific namerm
: Delete a file (if you make a mistake)rm -r
: Delete a directory (if you make a mistake)code
: edit the file in the VS Code editor
That’s it! See you Next Class!#
Additional Resources#
Supplementary video on absolute vs. relative paths#
IFrame(
"https://www.youtube-nocookie.com/embed/sqX6hu7oEew", width="100%", height="500px"
)
Guide to the operating system for macOS users#
IFrame(
"https://www.youtube-nocookie.com/embed/RX160bcMFuA", width="100%", height="500px"
)
Guide to the operating system for Windows 10 users#
IFrame(
"https://www.youtube-nocookie.com/embed/egK5BKEn87c", width="100%", height="500px"
)