In: Computer Science
Try to make it as simple as you can. Please provide the answers with some examples as fast as you can.
Linux
Using the following directory structure (See Structure question # 3)
-Determine the absolute path for the following files and directories:
- Your_Name_goes_here.dat
-Sales
-Assuming your current directory is RegionA, determine the relative pathname for the following files and directories:
-West1.dat
-RegionB
$HOME |
|||
Project4 |
|||
Payroll |
|||
.checks.dat |
|||
Pay2.dat |
|||
Sales |
|||
RegionA |
|||
East.dat |
|||
RegionB |
|||
West1.dat |
|||
Your_Name_goes_here.dat |
|||
West3.dat |
An Absolute Path is 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 which is the / directory.
$HOME is an environment variable which stores the location(absolute) of the user's home directory.
So, if my user name is user1, $HOME will generally contain /home/user1.
If I'm root $HOME will contain /root.
Now, if you are a normal user and user name is, let's say, user1.
The absolute path for Your_Name_goes_here.dat will be:-
$HOME/Project4/Sales/RegionB/Your_Name_goes_here.dat
which is equivalent to
/home/user1/Project4/Sales/RegionB/Your_Name_goes_here.dat
The absolute path for Sales will be:-
$HOME/Project4/Sales/
or
/home/user1/Project4/Sales/
_________________________________________________________________________________________
On the other hand, Relative Path is defined as path related to the present working directory(pwd).
Since your current directory is RegionA, the relative pathname for the following files and directories is:
West1.dat
../RegionB/West1.dat
.. is here for 1 directory upwards
RegionB
../RegionB