HomeToolsAbout

Paths

Absolute vs Relative Paths

Absolute path makes no assumptions about your current location in relation to the location of the file or directory it's describing

  • Compare to relative path which is location relative to your current location
# absolute /root/project/parent/file.txt # relative ../parent/file.txt

What is ~

~ is a Linux shortcut for user's home directory

Path to desktop would be: ~/Desktop

What is /

A path starting with / means the ROOT directory of the filesystem

Current Working Directory (cwd)

Every process has a current directory

  • When a process starts, it simply inherits the current directory from its parent process; and it's not, for example, set to the directory which contains the program you are running.

pwd stands for "print working directory"

  • Same thing as cwd, just a command to print out the location

History

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

  • a directory is just a peculiar type of file, whose contents is a collection of other files, which can also include other directories

This introduced the concept of a current working directory

  • What if you could say "from now on, until I say otherwise, all the files I am talking about will be in this particular directory"
  • Thus was the cd command born
AboutContact