Site icon TestingDocs.com

Absolute and Relative Paths

Overview

In this tutorial, we will learn about absolute and relative paths in Linux.

Absolute Path

The Linux file structure is a hierarchical structure and is like an inverted tree.

An absolute pathname of a file/directory is the path from the root directory(/). It is the complete path from the root directory listing all the intermediate directories.

 

The absolute path of the file in the Linux file structure will be unique. Any pathname that begins with the / or the ~ is an absolute pathname.

Examples

/  refers to the root directory

/home/testingdocs/Desktop

~/Desktop

The ~ is the absolute path of the user’s home directory.

/home/testingdocs is the home directory for the user. /home/testingdocs/Desktop and ~/Desktop both are same

Relative Path

A relative pathname is the path relative from the current working directory to the file.

Examples

../ is the parent directory

../testingdocs

../../etc

Linux Commands Tutorial page:

https://www.testingdocs.com/linux-basic-commands-tutorial/

More Information on Ubuntu Linux:
https://ubuntu.com/

Exit mobile version