2018-11-11 10:57:24 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category-page: fs
|
|
|
|
category-title: FileSystem
|
|
|
|
tags: absolute relative path
|
|
|
|
author: Marwan Announ
|
2018-11-15 20:09:21 +00:00
|
|
|
title: Relative paths
|
2018-11-11 10:57:24 +00:00
|
|
|
---
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
Relative path is defined as path related to the present working directory(pwd).<br>
|
|
|
|
Suppose I am located in /home/user and I want to change directory to /home/user/Documents.<br>
|
|
|
|
I can use relative path concept to change directory to Documents.
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-14 10:39:56 +00:00
|
|
|
<pre>
|
2018-11-15 20:09:21 +00:00
|
|
|
pwd
|
|
|
|
/home/user
|
|
|
|
cd Documents
|
|
|
|
pwd
|
|
|
|
/home/user/Documents
|
2018-11-14 10:39:56 +00:00
|
|
|
</pre>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
If you observe, there is a little bit difference between absolute and relative paths:
|
|
|
|
in relative paths there is no "/" at the very beginning.<br>
|
|
|
|
Meanwhile in an absolute path you have to write "/", in this case it'd be "/home/user/Documents".
|