Chapter 1 · Lesson 2
Beginner
2 min read
Filesystem Navigation and Absolute Paths
Overview
Linux stores files in one directory tree rooted at /. There is no C:; every disk, directory and device is reachable below that root. A path may start at the root (absolute) or from the current directory (relative).
Detailed Notes
The current directory
Every process has a current working directory. It is not the same as the terminal display. pwd prints the process's current location.
bash
pwd
ls
ls -l
ls -la
lslists entries.ls -lprints details.ls -laincludes hidden entries and details.
Hidden names begin with .. The two special entries are:
.means the current directory...means the parent directory.
Change directory
bash
cd /
pwd
cd /var/log
pwd
cd ..
pwd
cd ~
pwd
An absolute path starts with /. A relative path does not:
bash
cd linux-practice
cd ../documents
cd ~/linux-practice
~ expands to the current user's home directory. ~other-user refers to another user's home if permissions allow.
Directory tree
Common top-level directories:
| Path | Purpose |
|---|---|
/ | Root of the filesystem |
/home | Normal users' home directories |
/root | Root user's home |
/etc | System configuration |
/var | Logs, caches and changing application data |
/tmp | Temporary files |
/usr | Most installed programs and libraries |
/opt | Optional third-party software |
Practice
- Print your current location.
- Enter
/etc, list it and return home. - Create a directory with
mkdir ~/linux-practice/navigation. - Enter it using an absolute path.
- Enter
.., then..and checkpwd.
Absolute paths begin at `/`; relative paths begin at the current directory.
Common Interview Questions
Finished this lesson?
0 of 25 lessons done · 0% of the course

