Absolute Path and Relative Path

Absolute path and relative path in linux

Understanding absolute path and relative path in linux operating system is a essential point if you are in a beginner level. Since we need to have a clear understanding about the linux file path navigation, we have to get this absolute path and relative path understandable very well.

What is an Absolute Path ?

An absolute path is a fully qualified path. Simply, the path starting from the root “/” and it specifies each an every sub directory  that goes to the destination directory.
eg : /var/log/messages, /home/student/Videos, /etc/passwd
Like the above, absolute path starts from the root and displays all the directories along to the destination.

What is a relative Path ?

Not like absolute Path, relative path shows only the path necessary to reach the file from the present directory (means from the currently working directory).
eg : Guess the absolute path of a specific file is as below.
Absolute Path : /home/student/Documents/myUrlFiles/linuxschool4you.blogspot.com
And if your present working directory is /home/student/Documents, the relative path for linuxschool4you.blogspot.com is myUrlFiles/linuxschool4you.blogspot.com. 
 
As a summary,
if my present directory is  /home/student/Documents
So, absolute path and relative path for file linuxschool4you.blogspot.com is as below.
Absolute path – /home/student/Documents/myUrlFiles/linuxschool4you.blogspot.com
Relative path – myUrlFiles/linuxschool4you.blogspot.com
So, from this article i guess you got the useful of learning this speacial topic. It helps for your daily linux operations. This simplifies your taks and saves time.
Useful resources

4 thoughts on “Absolute Path and Relative Path

  1. Hello, I find this article very useful. I have one question about the path that starts with ~ Is this considered relative or absolute.

    1. Hi Prabhjot,

      I will explain. The mark ~ in linux meaning the home directory of the logged user. If the user is logged as user student, then the command cd ~ meaning go to the home directory of user student. so it will redirect to the path of /home/student. Like that whatever the command we use starting with ~ it means having the home directory. eg – cd ~/documents/linux/tutorials, the mentioned path is a absolute path. Since it runs the whole path with cd command.

      Please reach us if you need further explanation.

Leave a Reply