Difference between absolute path and relative path
Absolute and Relative Pathnames in Linux
You identify a File or Directory by it's PATHNAME:
The relative or absolute path name or of the location
A path is a unique location to a file or a folder in a file system of an OS.
A path to a file is a combination of / and alpha-numeric characters.
Absolute Pathname
An absolute path is defined as the specifying the location of a file or directory from the root directory(/).
To write an absolute path-name:
To write an absolute path-name:
- Start at the root directory ( / ) and work down.
- Write a slash ( / ) after every directory name (last one is optional)
Relative Pathname
Relative path is defined as the path related to the present working directly(pwd). It starts at your current directory and never starts with a / .
To be more specific let’s take a look on the below figure in which if we are looking for photos then absolute path for it will be provided as /home/ohhhvictor/Desktop but assuming that we are already present in ohhhvictor directory then the relative path for the same can be written as simple Desktop.
So ls /home /ohhhvictor/Desktop is the Absolute Path
I hope that you like the explanation. If you did, please click like 😛
Difference between absolute path and relative path
Reviewed by ohhhvictor
on
November 01, 2018
Rating:
No comments: