theshell.ch/site/pages/fs/absolute.html

39 lines
1.3 KiB
HTML
Raw Normal View History

---
layout: page
category-page: fs
category-title: FileSystem
tags: absolute relative path
author: Announ Marwan
title: Absolute paths
next-page: pages/fs/cd.html
---
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>
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>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>
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>
As you can see from the last commands, the path started from "/" which is the root directory
for every Unix machines.<br>
Here are some other examples of absolute paths:
<ul>
<li>/home/user/Document/group1.txt</li>
<li>/root/data/dev.zip</li>
<li>/var/log/messages</li>
</ul>