Absloute path vs relative path in Linux/Unix | Linux Today

Absloute path vs relative path in Linux/Unix

Written By
Web Webster
Web Webster
Mar 15, 2016

One of this blog follower asked us that what’s the difference between absolute and relative path?

To understand this we have to know what is a path in Linux.

What is a path?

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.
What is an absolute path?

An absolute path is defined as the specifying the location of a file or directory from the root directory(/). In other words we can say absolute path is a complete path from start of actual filesystem from / directory.

Some examples of absolute path:

/var/ftp/pub
/etc/samba.smb.conf
/boot/grub/grub.conf
If you see all these paths started from / directory which is a root directory for every Linux/Unix machines.

What is the relative path?
Relative path is defined as path related to the present working directory(pwd). Suppose I am located in /var/log and I want to change directory to /var/log/kernel. I can use relative path concept to change directory to kernel

changing directory to /var/log/kernel by using relative path concept.

pwd
/var/log
cd kernel
Note: If you observe there is no / before kernel which indicates it’s a relative directory to present working directory.

Changing directory to /var/log/kernel using absolute path concept.

cd /var/log/kernel
Note: We can use an absolute path from any location where as if you want to use relative path we should be present in a directory where we are going to specify relative to that present working directory.

Examples of relative path and absolute path for the same operation.
Read full post: http://www.linuxnix.com/abslute-path-vs-relative-path-in-linuxunix/

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.