550f961369
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@170 a672b425-5310-4d7a-af5c-997e18724b81
54 lines
2 KiB
HTML
54 lines
2 KiB
HTML
---
|
|
layout: page
|
|
category-page: fs
|
|
category-title: FileSystem
|
|
tags: absolute relative path
|
|
author: Marwan Announ
|
|
title: fs
|
|
---
|
|
<p>
|
|
<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.
|
|
<br> <br> <br>
|
|
<p> pwd/home/user1cd Documents </p>
|
|
|
|
<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.
|
|
|
|
<!-- esempi con altri comandi+foto -->
|
|
|
|
<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:
|
|
<pre>
|
|
<br><br>pwd
|
|
<br> cd .
|
|
<br><br>pwd
|
|
<br> cd ..
|
|
<br><br>pwd
|
|
<br> cd ..
|
|
<br><br>pwd
|
|
<br> cd
|
|
</pre>
|
|
|
|
<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
|
|
|
|
|
|
<br><br> <h3> Why Relative Path!? </h3>
|
|
|
|
Now, if you read the last page regarding Absolute path you can ask me, good, but how i can know if is an Absolute or Relative?
|
|
<br>If the question is this , you can continue the reading, else please try to do the quiz to verify what you have learn
|
|
<br>about path, Absolute and Relative.
|
|
<br>Ok, you have to know that Pathnames with no leading slash on the left are called RELATIVE pathnames, so, if you look and there
|
|
<br>are no slash on the left you know that is a relative.
|
|
<br>For example, "/bar" is not a relative because have slash on the left, but you have to know that relative path can have slash before.
|
|
<br>If you observe ../bar have slash, but it's not an asbolute(after the previous reading you have to know why it's not an absolute ;) )
|
|
|
|
|
|
</p>
|
|
<!-- quiz in javascript about relative and what the user know after the reading-->
|