From the free course The Missing Semester of Your CS Education on Lykke
Introduction to the Shell
Key concepts: The Shell vs. Terminal · Navigation (cd, pwd) · $PATH Environment Variable · Manual Pages (man)
Foundational navigation and file manipulation using the textual interface of the shell.
Introduction to the Shell
Overview
Most CS curricula focus on high-level programming but ignore the environment where that code lives. The Shell is a powerful textual interface for interacting with the operating system, offering more precision and automation than a Graphical User Interface (GUI).
Key Concepts
- The Shell vs. Terminal: The terminal is the window (the wrapper), while the shell is the program interpreting your commands (e.g., Bash, Zsh).
- Navigation: Mastering
cd(change directory),pwd(print working directory), and understanding absolute vs. relative paths is essential for moving through the filesystem. - The $PATH: A list of directories the shell searches through to find executable programs. Understanding $PATH is critical for troubleshooting 'command not found' errors.
- Documentation: Use
man(manual pages) to discover flags and arguments for any command without leaving the terminal.
Why This Matters
Efficiency begins with navigation. Moving through files and executing programs via the shell is the first step toward automating your entire workflow.
Flashcards
- What is the difference between a Terminal and a Shell?: The Terminal is the wrapper/window application that displays text; the Shell is the actual program (like Bash or Zsh) that interprets and executes your commands.
- What does the 'pwd' command do?: It stands for 'Print Working Directory' and displays the full absolute path of the directory you are currently in.
- What is the difference between an Absolute Path and a Relative Path?: An Absolute Path starts from the root directory (/) and is the same regardless of your location. A Relative Path starts from your current directory.
- What is the purpose of the $PATH environment variable?: It is a list of directories the shell searches through to find executable programs when you type a command.
- How do you view the documentation for a specific command within the shell?: Use the 'man' command followed by the command name (e.g., 'man ls') to open the manual pages.
Study Guide
Introduction to the Shell
Overview
The shell is a command-line interpreter that acts as a bridge between the user and the operating system. Unlike Graphical User Interfaces (GUIs) that rely on clicking icons, the shell allows for precise control, complex automation, and remote server management through text-based commands.
Navigation and Environment
Navigating the filesystem is the most fundamental shell skill. You move using cd (change directory) and check your location with pwd. Understanding paths is crucial: absolute paths provide the full address from the root (/), while relative paths are shortcuts based on where you are right now.
Behind the scenes, the shell uses environment variables like $PATH to function. The $PATH variable is essentially a 'search list' for the shell; when you type a command, the shell looks through every folder in that list to find the program. If you need help with a command's syntax or flags, the man (manual) system provides built-in documentation for almost every utility.
- Terminal vs Shell: The terminal is the UI window; the shell is the logic engine.
- pwd: Prints the current working directory path.
- cd [directory]: Changes your current location in the filesystem.
- $PATH: A colon-separated list of directories containing executable files.
- man [command]: Displays the reference manual for a specific command.
- Absolute Path: A path starting from the root directory (e.g.,
/usr/bin).
Infographic
Source Materials
Study The Missing Semester of Your CS Education on Lykke
This course page is free to open: signed out, you can read its first two sections, and signing in, on any plan, opens the rest. The free Lykke Chrome extension syncs your own Canvas courses, so ChatGPT, Claude and Muse can answer from your classes and deadlines. It only reads Canvas.
Add the free extensionSign in to open every sectionAll sections of The Missing Semester of Your CS Education · Browse more course pages