2018-11-11 10:57:24 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category-page: fs
|
|
|
|
category-title: FileSystem
|
|
|
|
tags: absolute relative path
|
2018-11-16 19:47:01 +00:00
|
|
|
author: Announ Marwan
|
2018-11-15 20:09:21 +00:00
|
|
|
title: Absolute 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
|
|
|
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>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
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>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
<h3>To write an absolute path-name:</h3>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
Start at the root directory ( / ) and work down.<br>
|
|
|
|
Write a slash ( / ) after every directory name (last one is optional).<br>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
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>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
As you can see from the last commands, the path started from "/" which is the root directory
|
|
|
|
for every Unix machines.<br>
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
Here are some other examples of absolute paths:
|
2018-11-12 12:04:46 +00:00
|
|
|
|
2018-11-15 20:09:21 +00:00
|
|
|
<ul>
|
|
|
|
<li>/home/user/Document/group1.txt</li>
|
|
|
|
<li>/root/data/dev.zip</li>
|
|
|
|
<li>/var/log/messages</li>
|
|
|
|
</ul>
|