Explore this subdirectory and report any hard or soft link that you can identify
ID: 3871630 • Letter: E
Question
Explore this subdirectory and report any hard or soft link that you can identify there. Submit your results in a ASCII text file named a2q5.txt. Briefly explain how you reached your conclusions. You can report your findings using a textual diagram in the following style:
4 /users/faculty/prof2132/public/a2q5
|-- a |
|-- a1
| | |-- f1
| | |-- f2
| | |-- f3 =hardlink=> f1
| | ‘-- f4 -softlink-> f2
|-- a2
| |-- f1
| ‘-- f2
‘-- b
I understand how to find the softlinks. When you type ls -l for the file it shows an l before the permissions and also shows where the shoft link is at the end. (ex a1 -> a2). However how do I tell if the file is a hardlink and where it is hardlinked to? thanks
Explanation / Answer
What you said is exactly correct for symlinks or soft links.
But the same is not the case for hardlinks.
You cannot find directly where it is directly mapping to. Unfortunately, there is no way to find the exact mapping detail. That information will not be stored anywhere.
You cannot say if a file is hardlink or a original one. Because both shares same content and inodes. You can find inodes of files with command 'ls -i'.
If inodes of files are same, then one of them is original and others can be hardlinks. But still we cannot say, like this is hardlink.
hardlinks are not different files. they are just different names to a original file.
With 'll' command you can find how many hardlinks a file has. It will mention after permissions.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.