Linuxlab

Paths in Linux: absolute and relative

Updated July 3, 2026

An absolute path is a path from the root /, while a relative path is read from the current directory.

Common cases

/home/student/file   # absolute: from the root, always the same
docs/file            # relative: from the current directory
..                   # the directory one level up
cd ~/project && cat ../notes.txt   # .. goes up one level

How it works: . and .. and the tilde

Every directory has two special entries: . is the directory itself and .. is its parent. So ./script runs a file from the current directory, and cd .. moves one level up. ~ is shorthand for your home directory, which the shell expands to /home/student. An absolute path does not depend on where you stand; a relative path is shorter but changes meaning when you change directory.

Used in

You need this in the lesson The filesystem and navigation. The theory is the chapter The filesystem and moving around.

See also

Hidden files, The ls command.

Try it

Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.