Javatpoint Logo
Javatpoint Logo

Linux Absolute and Relative Paths

It is very important to know the difference between absolute and relative path. Because correct path will only lead you to your destination directory.

When you define a path starting with a slash ('/') sign, then root of the file is assumed. If you don't put a '/' then the current directory is assumed to be the starting point.

In below example, we're at /home/sssit. To go to home directory we typed cd /home instead of cd home.

Absolute and Relative Paths1

Below you can see that we're getting an error by typing cd /sssit instead of cd sssit, because sssit is a sub-directory of home and hence it can't be accessed with a root ('/').

Absolute and Relative Paths2

If currently you are in the root directory, then you can give command home or /home. Both will lead you to the home directory because you are already on the root directory.

Absolute and Relative Paths3




Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA