Linux Fundamentals

Lesson 2 of 7

Filesystems

A Linux filesystem is organized as a single tree, starting from one root directory, /, with everything else nested underneath it, unlike Windows there's no separate "C:" drive.

/
├── home/
│   └── ada/       # your personal files usually live here
├── etc/            # system configuration files
├── usr/            # installed programs
└── tmp/            # temporary files, cleared periodically

Navigating

cd /home/ada       # change directory (absolute path, starts with /)
cd Documents       # relative path, relative to where you already are
cd ..              # go up one level
cd ~               # jump to your home directory
ls -la             # list files, including hidden ones (-a) with details (-l)

An absolute path always starts from / and works no matter where you currently are. A relative path is interpreted starting from your current directory, so cd Documents only works if Documents exists right where you're standing.

Managing files

mkdir projects           # create a directory
touch notes.txt          # create an empty file
cp notes.txt backup.txt  # copy
mv notes.txt todo.txt    # rename/move
rm backup.txt            # delete a file
rm -r old_folder         # delete a directory and everything in it (recursive)

WARNING

rm does not move files to a trash bin, it deletes them immediately and permanently. rm -r on the wrong directory is one of the most common ways people lose real work, always double-check the path before you hit enter.

📝 Filesystems Quiz

Passing score: 70%
  1. 1.What does a relative path like "Documents" (without a leading /) depend on?

  2. 2.Files deleted with rm on Linux are moved to a recoverable trash/recycle bin by default.

  3. 3.The command to create a new, empty directory is: ____ <name>