2018-11-08 10:05:48 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category: Filesystem
|
2018-11-09 07:13:40 +00:00
|
|
|
tags: absolute relative path
|
2018-11-08 10:05:48 +00:00
|
|
|
author: Marwan Announ
|
|
|
|
title: fs
|
|
|
|
---
|
|
|
|
|
2018-11-08 09:55:57 +00:00
|
|
|
<h1>Relative Path!</h1>
|
|
|
|
|
|
|
|
Relative path is defined as path related to the present working directory(pwd).
|
|
|
|
<br>Suppose I am located in /home/user1 and I want to change directory to /home/user1/Documents.
|
|
|
|
<br>I can use relative path concept to change directory to Documents.
|
2018-11-09 07:13:40 +00:00
|
|
|
<br> <br> <br>
|
|
|
|
<p> pwd/home/user1cd Documents </p>
|
2018-11-08 09:55:57 +00:00
|
|
|
|
|
|
|
<br> <br> <br> Then you could tell me what is the difference between Absolute and Relative.
|
|
|
|
|
|
|
|
<br> If you observe, there is a little bit difference, where in relative there is no "/".
|
|
|
|
<br> Meanwhyle using absolute path you have to write "/", in this case cd /home/user1/Documents.
|
|
|
|
|
2018-11-08 11:43:39 +00:00
|
|
|
<!-- esempi con altri comandi+foto -->
|
|
|
|
|
2018-11-09 07:13:40 +00:00
|
|
|
<h2>Example of Relative path's uses:</h2>
|
|
|
|
Now, as we learned from the previous pages we can use other commands in addition to "cat", such as:
|
2018-11-08 11:43:39 +00:00
|
|
|
|
2018-11-09 07:13:40 +00:00
|
|
|
<br><br>pwd
|
|
|
|
<br> cd .
|
|
|
|
<br><br>pwd
|
|
|
|
<br> cd ..
|
|
|
|
<br><br>pwd
|
|
|
|
<br> cd ..
|
|
|
|
<br><br>pwd
|
|
|
|
<br> cd
|
2018-11-08 11:43:39 +00:00
|
|
|
|
2018-11-09 07:13:40 +00:00
|
|
|
<br><br><br> and so on.. I know, it's boring but it is one of the disadvantages of not being present in the
|
|
|
|
<br>working directory
|
2018-11-08 11:43:39 +00:00
|
|
|
|
|
|
|
<h3> Now I will show you in many examples.</h3>
|
|
|
|
|
2018-11-09 14:09:49 +00:00
|
|
|
<!--<p>
|
2018-11-09 07:13:40 +00:00
|
|
|
<img src="1.1.jpg" alt=" pwd to know where i am "/>
|
|
|
|
</p>
|
2018-11-08 11:43:39 +00:00
|
|
|
|
2018-11-09 07:13:40 +00:00
|
|
|
<p>
|
|
|
|
<img src="1.2.jpg" alt="relative paths command"/>
|
|
|
|
</p>
|
2018-11-08 11:43:39 +00:00
|
|
|
|
2018-11-09 07:13:40 +00:00
|
|
|
<p>
|
|
|
|
<img src="1.3.jpg" alt=" funning with 'cd to return back"/>
|
2018-11-09 14:09:49 +00:00
|
|
|
</p> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- quiz in javascript about relative and what the user know after the reading-->
|