0% found this document useful (0 votes)
4 views

Path in Unix

Uploaded by

Himani Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Path in Unix

Uploaded by

Himani Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Path

Dr. Sarvesh Tanwar


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.
Example
Absolute Path
• An absolute path is defined as specifying the location of a file or
directory from the root directory(/). In other words, we can say that
an absolute path is a complete path from start of actual file system
from / directory.

• Absolute path starts from the directory root (/) and goes up to the
actual object (file or directory). It contains the names of all directories
that come in the middle of the directory root and the actual object. In
this, name of the parent directory is written in the left.
• Suppose you are currently located in home/kt and you want to
change your directory to home/kt/abc.

• Changing directory with absolute path concept:


• $pwd
• /home/kt
• $cd /home/kt/abc
• $pwd
• /home/kt/abc
Key points

• First forward slash (/) in the absolute path represents the directory root.
Besides this, all slashes in the path represent the directory separator.
• Besides the last name, all names in the absolute path belong to
directories. Last name can belong to file or directory.
• In the absolute path, directories names are written in their hierarchy
order. Parent directory’s name is written in the left side.
• Absolute path does not change when we change the current directory.
• To know to the absolute path of the current directory, we can use the
command pwd.
Relative path
• Relative path is defined as the path related to the present working
directory(pwd). It starts at your current directory and never starts
with a / .

• Relative path starts from the current directory and goes up to the
actual object. Relative path depends on the current directory.
• When we change the directory, relative path also changes. Just like
the absolute path, the name of the parent directory is written in the
left side. Unlike the absolute path, all slashes in the relative path
represent the directory separator.
Relative path also uses these dots to represent the current directory and the
parent directory respectively. With the use of these dots, we can build the
relative path of any file or directory from the current directory.
Changing directory with relative path concept :
• $pwd
• /home/kt
• $cd abc
• $pwd
• /home/kt/abc

You might also like