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 |
PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU
The absolute path file directories can be determined by combining both readlink and dirname command. It can obtained through xargs command.
command for
[- Your_Name_goes_here.dat
-Sales ] file and directory is :-
readlink -f Sales / Your_Name_goes_here.dat| xargs dirname
The command will return :- /file/data/Sales/Your_Name_goes_here.dat
For example:- Using this command for a file name Sample.txt [readlink -fsample / file.txt| xargs dirname] We get resultant as- /data/example/sample.
**the relative pathname for the following files and directories:
-West1.dat
-RegionB
=> Since the current directory is RegionA so to get the pathname of RegionB. First, we have to go outside of the current file directory using (..).
Further the command for RegionB relative pathname:-
$ cat ..RegionB/West1.dat
$cat command is the concatenate command which is used to read data from the file and gives their content as output.