Absolute
vs Relative
PathsAbsolute path
makes no assumptions about your current location
in relation to the location of the file or directory it's describing
Relative path
is location relative to your current location
.
# absolute /root/project/parent/file.txt # relative ../parent/file.txt
~
~
is a Linux shortcut for user's home directory
Path to desktop would be: ~/Desktop
/
A path starting with /
means the ROOT directory
of the filesystem
cwd
)Every process has a current directory
current directory
from its parent process.current directory
is not set to the directory which contains the program you are running.pwd
vs cwd
pwd
stands for print working directory
.
cwd
, just a command to print out the location.When disks became large enough that you did not want all your files in the same place, operating system vendors came up with a way to structure files in directories.
Directory is just a peculiar type of file, whose contents is a collection of other files, which can also include other directories.
Directories introduced the concept of a current working directory
.
cd
command born