Linux module
Lesson 3
The filesystem is your data lake
Paths, home, and how to move around directories like a data server.
beginner30 minRun on your machine
What you will be able to do
- Explain absolute vs relative paths and what ~ means
- Use pwd, cd, and ls to move and look around
- Recognize directories you will see on data servers
Why this matters for DE and AI
A “data lake” on a server is, at the bottom, directories on a disk. CSV dumps, Parquet partitions, model checkpoints, and log files all have a path. If you cannot move around a filesystem, you cannot debug a job that wrote to the wrong place.
Concepts
Linux (and macOS) organize files in a tree that starts at /, called root. Not the same as the administrator user named root.
/ ← the top
├── home/ ← user folders on Linux
│ └── sam/
├── Users/ ← user folders on macOS
├── tmp/ ← throwaway files
├── var/log/ ← system and app logs on Linux servers
└── opt/ ← optional software, common on servers
On many data teams people also create /data for datasets. That is a convention, not a law.
Home and ~
Your home directory is yours. On Ubuntu/WSL it is /home/YOURNAME. On macOS it is /Users/YOURNAME.
~ is shorthand for that home. ~/dcubes/linux-lab is the lab folder.
Absolute vs relative paths
- Absolute — starts at
/. Same place no matter where you are. Example:/tmp. - Relative — starts from the directory you are in. Example:
linux-labwhen you are already in~/dcubes.
pwd prints where you are. Always run it when you feel lost.
The three commands
| Command | Meaning |
|---|---|
pwd |
Print working directory |
cd PLACE |
Change directory to PLACE |
ls |
List names in the current directory |
ls -la |
List all files, including hidden ones, with details |
cd or cd ~ |
Go home |
cd - |
Go back to the previous directory |
cd .. |
Go up one level |
Hidden files start with a dot: .bashrc. ls hides them. ls -la shows them.
Tab completion: type the first letters of a folder and press Tab. The shell fills the rest if it is unique.
Practice on your machine
cd ~
pwd
What you should see: /home/YOURNAME or /Users/YOURNAME.
ls
ls -la
The second listing is longer. Names starting with . are configuration files. Do not delete them.
Go to the lab, then up, then back:
cd ~/dcubes/linux-lab
pwd
cd ..
pwd
cd linux-lab
pwd
Visit /tmp (a shared scratch folder) and return:
cd /tmp
pwd
ls
cd -
pwd
What you should see after cd -: you are back in linux-lab.
Try tab completion:
cd ~/dc<Tab>
It should expand toward dcubes.
Look at / without staying there:
ls /
On Linux you should see names like home, tmp, etc. On macOS you will see Users, Applications, tmp.
Common mistakes
cd ~/dcubes/linux-labwith a typo. The shell saysNo such file or directory. Runls ~andls ~/dcubesto see what actually exists.- Confusing
cdwithls.lslooks.cdmoves. You canls /tmpwithout going there. - Spaces in names. Avoid them in this module. If a name has a space, you must quote it:
cd "My folder". Data pipelines also prefer names without spaces.
Next
Create and organize files — mkdir, touch, cp, mv, rm.