Absolute and Relative Paths¶
Path Separator¶
First off: in UNIX, the path separator is the forward slash:
/
(as opposed to Doze which chose the backslash,\
)
Relative Paths¶
Don’t begin with a
/
Interpreted relative to the current working directory (CWD)
$ pwd
/home/jfasch
$ cd Documents
$ pwd
/home/jfasch/Documents
$ cd ../Downloads
$ pwd
/home/jfasch/Downloads
Absolute Paths¶
Start with a
/
“Relative” to the root directory
⟶ Independent of CWD
$ cd /etc
$ pwd
/etc
Special Paths¶
/
: root directory - where it all begins~
: home directory of the user$ id -u 1000 $ id -un jfasch $ pwd /etc $ cd ~ $ pwd /home/jfasch
~someone-else
: home directory of someone else.
: current working directory$ pwd /home/jfasch $ cd . $ pwd /home/jfasch
..
: parent directory of CWD$ cd .. $ pwd /home
$ ls -l total 0 drwx------. 1 jfasch jfasch 554 Mar 8 10:51 jfasch drwx------. 1 someone-else someone-else 92 Mar 3 14:12 someone-else
.
and..
are regular path components …$ cd ~jfasch/../someone-else $ pwd /home/someone-else