Linux pathname Relative Vs. Absolute

Linux directories are helpful to store files. Many a time, the programmer would trade in directory paths. The paths are two types - absolute and relative. I have shared simple ideas to remember the differences between these two.


Absolute vs Relative
Linux

Absolute Vs. Relative

Below are the differences between these two.

Absolute pathname


An example is /usr/lib, which is an exact directory in the directory tree. 


Think of the absolute pathname as being the complete mailing address for a package that the postal service will deliver to your next-door neighbor.

Relative directory name


An example is cups, which represents the cups subdirectory of the current directory, whatever that may be. 


Think of the relative directory name as giving the postal carrier directions from your house to the one next door so that the carrier can deliver the package.

How to go back to the home directory

If I type cd cups in /usr/lib, the current directory changes to /usr/lib/cups. If type the same command in /home/edulaney, the shell tries to change the current directory to /home/edulaney/cups.



If you type cd, without any arguments, it will go to the home directory.



Keep Reading

Comments

Popular Posts

How to Fix Python Syntax Errors Quickly

7 AWS Interview Questions asked in Infosys, TCS

Python 'getsizeof' Command the Real Purpose

Hyperledger Fabric: 20 Real Interview Questions

How to Decode TLV Quickly

AWS Vs Azure Load Balancers Top Insights

How to Use the ps Command in Linux

QlikView Server vs Publisher Top Differences Really Useful to Your Project

Top 10 SCALA Quiz Questions for Programmers

Python Syntax Errors Cheat Sheet