Q1Which is the correct description of an absolute path?
Paths and Directory Navigation — Absolute vs Relative
This article is part of the Linux Course, where you master practical Linux skills from scratch, from basic commands through to shell scripting.
Learn absolute vs relative paths, how to use the special symbols . .. ~ /, and how to read your location with pwd and ls -l — by moving around in a browser terminal.
Absolute and relative paths
A path is a string that describes the location of a file or directory.
One that starts from / is an absolute path (a complete route from the top of the file system), and one written from your current location is a relative path.
cd /tmp moves by absolute path; cd .. moves by relative path.
/; a relative path from your current location.cd /tmp # move by absolute path
pwd # /tmp
cd .. # up one level by relative path
pwd # /
cd ~ # to home
pwd # /root
Special symbols — / . .. ~
Inside a path, the following symbols have special meaning.
Combine them and you can move flexibly relative to your current location.
. refers to the directory you're in right now, and is used for things like a copy destination or an execution path.
When / appears in the middle of a path, as in /etc/hostname, it acts as a separator joining directories together.
| Symbol | Meaning |
|---|---|
/ | Root (top level). At the start it means an absolute path; in the middle it's a separator |
. | The current directory |
.. | The parent directory one level up |
~ | The home directory (here, /root) |
ls . # the current location = same as omitting it
cp /etc/hostname . # copy to the current directory
./script.sh # run from the current directory
mkdir -p a/b/c # create a hierarchy for practice
cd a/b/c # move deep by relative path
pwd # ends with /a/b/c
cd ../.. # go up two levels
pwd # ends with /a
Read your location — pwd and ls -l
pwd shows the absolute path of your current location.
ls -l lists the items in that directory in detail, one per line, and passing it a path like ls -l / lets you check that location's contents without moving there.
pwd for your location, ls -l for that location's contents.pwd # current absolute path
ls -l # detailed listing of the current location
ls -l / # check directly under root without moving
Knowledge Check
Answer each question one by one.
Q2What does .. refer to in a path?
Q3What does pwd display when you run it?