Modify contents of 3 oages html of filesystem and add text
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@135 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
710b34ac79
commit
46f09de88e
3 changed files with 116 additions and 36 deletions
site/pages/fs
|
@ -16,3 +16,17 @@ title: fs
|
|||
</p>
|
||||
|
||||
<!-- quiz about absolute vs relative, where the user have to choose one or another(javascript) -->
|
||||
|
||||
<h2> I'm sure that if you read this for two times or more you will able to pass the quiz </h2>
|
||||
|
||||
Yeah, right, there is a quiz.
|
||||
<br> The best way to learn something it's not the theory, in fact you have to do some practice, if you click
|
||||
<br> the button "QUIZ", you can try to do a quiz to check what you read.
|
||||
|
||||
<br><br><br> Don't worry it's for you, good luck
|
||||
|
||||
|
||||
<br><br><br> * for css, please try to do a button or layout to links the quiz*
|
||||
|
||||
|
||||
<!-- quiz di javascript pronto che linkero -->
|
||||
|
|
|
@ -4,34 +4,71 @@ category-page: fs
|
|||
category-title: FileSystem
|
||||
tags: absolute relative path
|
||||
author: Marwan Announ
|
||||
title: Absolute paths
|
||||
title: paths
|
||||
---
|
||||
|
||||
<h1>Absolute Path</h1>
|
||||
|
||||
<h2>First, what is a path?</h2>
|
||||
|
||||
<p>
|
||||
A path is a location to a folder or file in a file system of a Operating System,
|
||||
then is a combination of characters and "/".<br>
|
||||
A path is a location to a folder or file in a file system of a Operating System, then is a combination of characters
|
||||
and "/"
|
||||
</p>
|
||||
|
||||
An absolute path is defined as specifying the location of a file or directory
|
||||
from the root directory (/).In other words we can say absolute path is a complete
|
||||
path from start of actual filesystem from / directory.<br><br>
|
||||
<h3>Now, what is an Absolute path?</h3>
|
||||
|
||||
<h3>To write an absolute path-name:</h3>
|
||||
|
||||
Start at the root directory ( / ) and work down.<br>
|
||||
Write a slash ( / ) after every directory name (last one is optional).<br>
|
||||
<p>
|
||||
An absolute path is defined as specifying the location of a file or directory from the root directory(/).
|
||||
In other words we can say absolute path is a complete path from start of actual filesystem from / directory.
|
||||
</p>
|
||||
|
||||
If for example, we the commands "cat group1.txt", it'll work only and only if the "group1.txt"
|
||||
exist in the current directory.<br>
|
||||
If doesn't works, it's not a problem, you just have to know where the file is actually stored.<br>
|
||||
Now, we suppose that you know where your file is saved so you can rewrite the command.
|
||||
"cat /home/a1/group1.txt".<br>
|
||||
<h4>To write an absolute path-name:</h4>
|
||||
|
||||
As you can see from the last commands, the path started from "/" which is the root directory
|
||||
for every Unix machines.<br>
|
||||
<p>
|
||||
Start at the root directory ( / ) and work down.
|
||||
<br>Write a slash ( / ) after every directory name (last one is optional)
|
||||
</p>
|
||||
|
||||
Here are some other examples of absolute paths:
|
||||
<h5>Example:</h5>
|
||||
|
||||
<ul>
|
||||
<li>/home/user/Document/group1.txt</li>
|
||||
<li>/root/data/dev.zip</li>
|
||||
<li>/var/log/messages</li>
|
||||
</ul>
|
||||
<p> cat group1.txt </p>
|
||||
if for example, we use the above line, this commands work only and only if the "group1.txt" exist in the current
|
||||
directory.
|
||||
<br> If not works, it's not a problem, the file is present somewhere, before restart the new command, you have to
|
||||
know where
|
||||
<br> the file is saved.
|
||||
<br> Now, we supposed that you know where your file is saved you can rewrite the command.
|
||||
<p> cat /home/a1/group1.txt</p>
|
||||
Now, we suppose that the file is saved into folder a1 in home,
|
||||
<br>where: /home is the location respect to root, in fact, you have to descend one level
|
||||
<br>in the file system like above to access your file.
|
||||
|
||||
As you can see from the last commands, all the paths started from /directory whis is a root directory for every Unix
|
||||
machines.
|
||||
|
||||
<p> Other examples, where all are absolute path</p>
|
||||
|
||||
/home/user/Document/group1.txt
|
||||
/root/data/dev.jpg
|
||||
/var/log/messages
|
||||
|
||||
<h6>Example of Absolute path's uses:</h6>
|
||||
Now, as we learned from the previous pages we can use other commands in addition to "cat", such as:
|
||||
|
||||
<br>ls /etc
|
||||
<br>ls /usr/share/games if you have games obviously :)
|
||||
<br>cd /usr/share/games
|
||||
<br>cd ~
|
||||
<br>cat /etc/passwd
|
||||
<br>cp /etc/passwd /tmp
|
||||
<br>cd /tmp
|
||||
<br>cat passwd
|
||||
|
||||
|
||||
<br><br><br> <h7> Read this if you are not Bill Gates, so read this.. </h7>
|
||||
|
||||
<p> So, if you dont't understand anything, like me before this writing, you have to know that Absolute pathnames start with a
|
||||
<br>slash on the left(simplyfied version..).
|
||||
<br>For example etc/passwd is a good example of Absolute pathnames.
|
||||
|
|
|
@ -4,21 +4,50 @@ category-page: fs
|
|||
category-title: FileSystem
|
||||
tags: absolute relative path
|
||||
author: Marwan Announ
|
||||
title: Relative paths
|
||||
title: fs
|
||||
---
|
||||
|
||||
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.
|
||||
<h1>Relative Path!</h1>
|
||||
|
||||
<pre>
|
||||
pwd
|
||||
/home/user
|
||||
cd Documents
|
||||
pwd
|
||||
/home/user/Documents
|
||||
</pre>
|
||||
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>
|
||||
|
||||
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".
|
||||
<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:
|
||||
|
||||
<br><br>pwd
|
||||
<br> cd .
|
||||
<br><br>pwd
|
||||
<br> cd ..
|
||||
<br><br>pwd
|
||||
<br> cd ..
|
||||
<br><br>pwd
|
||||
<br> cd
|
||||
|
||||
<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 ;) )
|
||||
|
||||
|
||||
|
||||
<!-- quiz in javascript about relative and what the user know after the reading-->
|
||||
|
|
Loading…
Reference in a new issue