Title: Absolute, Tilde and Relative Path
Course: CIS 121: Linux/UNIX I: Fundamentals ~ For IGNITE Review > Section: Learning Modules

Absolute Path ALWAYS starts with a slash (/). The '/' represents the top of the directory structure. It is called “root” or “slash”.

- The command cd / takes you to the top directory.
- The command cd /home/students takes you to the “students” directory which is under “home” directory which is under “/”.
- When '/' comes first, it is referencing the top directory. Otherwise, it separates directories names and file names in a path.

Absolute Path always works the same from everywhere.

Tilde Path

There are two forms: cd ~ and cd ~uname.

- cd ~ takes you to YOUR home directory.
- cd ~uname takes you to uname's home directory.
- cd ~/dir1 takes you to YOUR dir1 directory under YOUR home directory.
- cd ~uname/dir1 takes you to the dir1 directory under uname's home directory.

Tilde Path works the same from anywhere under most conditions.

Relative Path

Relative to your current directory (pwd). Where you end up depends on where you start.

- Use .. to go up.
- Use directory name to go down.

For example:

- cd .. Up one directory (to the parent directory).
- cd ../.. Up two directories (to the parent of the parent).
- cd dir1 Go down to dir1 which is a subdirectory of your current directory.
- cd dir1/dir11 Go down to dir11 which is below dir1 which is below your pwd.
- cd ../dir2 Go up one directory and then down to dir2. dir2 would be “beside” your current directory.