Linux
Filesystem & Navigation
One tree from /, absolute vs relative paths.
Concept core idea Watch out easy to get wrong
Concept
Key concepts
- Single tree rooted at
/; no drive letters. Absolute path starts at/; relative path starts from the current directory..= here,..= parent. - Relative paths in code (
open("config.txt")) resolve against the process's working directory — a common 'file not found' bug. - Commands:
pwd(where am I),ls -la(list, long, all),cd ..(up one).
Watch out
Easily confused
absolute vs relative path
Absolute starts at
/ (same everywhere). Relative starts from the current working directory (depends where you run it).. vs ..
. = the current directory. .. = the parent directory.Test yourself
6 questions on this lesson. Write your answers from memory, then compare them with the model answers side by side.