The linux operating system has a method of storing data in files and directories so that it can keep track of additions, modifications, and other changes.
In Linux, every file is stored in a directory. Directories can also contain subdirectories and it may also contain files and other subdirectories.
There are two kinds of paths, depending on how you describe them.
Relative Path
A relative path describes the route starting from your current location in the tree.
Absolute Path
An absolute path describes the route to the new location starting from the tree trunk (the root directory).
Navigating via the shell prompt utilizes either relative or absolute paths. In some instances, relative paths are shorter to type than absolute paths. In others,the absolute path is easier to remember.
There are two special characters used with relative paths. These characters are "." and "..". A single period, ".", is shorthand for "here". It references your current working directory. Two periods, "..", indicates the directory one level up from your current working directory. If your current working directory is your home directory, /home/user/, ".." indicates the next directory up, /home/.
Consider moving from the /usr/share/doc/ directory to the /tmp/ directory. The relative path between the two requires a great deal of typing, and requires knowledge of the absolute path to your current working directory. The relative path would look like this: ../../../tmp/. The absolute path is much shorter: /tmp/. The relative path requires you to move up three directories to the / directory before moving to the /tmp/ directory. The absolute path, which always starts at the / directory, is much simpler.
However, in
linux the relative path between two closely-related directories may be simpler than the absolute path.
There is no right or wrong choice: both relative and absolute paths point to the same branch of the tree. Choosing between the two is a matter of preference and convenience.
     
send to a friend                  
moby@mylinuxplanet.com