UNIT 4: Navigation & Control
In Windows, you double-click folders. In Linux, you are blindfolded. You must visualize the map in your head.
1. The File Hierarchy
There is no C: drive. There is only Root ( / ).
/bin: Binaries (Programs like ls, pwd)/home: User files (Documents, Downloads)/etc: System Configuration
2. Absolute vs Relative Paths
This is how you tell Linux where to go. Think of it like GPS vs giving directions.
Absolute Path
The full address from Root.
The full address from Root.
cd /home/student/Documents
Relative Path
The step from where you are.
The step from where you are.
cd Documents
3. Navigation Commands
The "Big Three" commands you will use 90% of the time:
pwd # Print Working Directory ("Where am I?")
ls # List Files ("What is here?")
cd # Change Directory ("Move me.")
ls # List Files ("What is here?")
cd # Change Directory ("Move me.")
4. File Management
How to create and destroy.
mkdir Project # Create a folder called Project
touch note.txt # Create an empty file
cp note.txt copy.txt # Copy a file
mv note.txt Project/ # Move (or Rename) a file
rm note.txt # DELETE file (Permanent!)
touch note.txt # Create an empty file
cp note.txt copy.txt # Copy a file
mv note.txt Project/ # Move (or Rename) a file
rm note.txt # DELETE file (Permanent!)
5. Viewing Files
Servers don't have Microsoft Word. You read text directly in the terminal.
- cat file.txt : Dumps the whole file to the screen.
- less file.txt : Opens file in a scrollable viewer (Press 'q' to exit).
- head file.txt : View just the first 10 lines.
- tail file.txt : View the last 10 lines (Great for logs).
MISSION: Read the file secret.txt using the cat command.