Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Give concise answers to the two questions below. Use either emacs or vi to type

ID: 3881488 • Letter: G

Question

Give concise answers to the two questions below. Use either emacs or vi to type your answers in one single plain ASCII file, with a2q1.txt as its name. Each line of this file should have at most 80 characters.

(i) [3 marks] What does a soft link file store as its data part?

(ii) [3 marks] How to find out the number of hard links to a regular file?

In your answer, clearly state the command needed for this task and how this command should be used here. State where you can find the number of hard links in the output of this command.

Explanation / Answer

Both are pointers to files, the difference is the kind of pointer.

(i)

Soft link also called as symboli link. A symbolic link points to another file by name. It has a special mode bit that identifies it as a symbolic link, and its contents are the name of the real file. Because it just contains a name, that name does not actually have to exist, or may exist on a different filesystem. If you replace the named file (change its contents without affecting its name), then the link still contains the same name, and so now it points to the new file. You can easily identify a symbolic link and see the name of the file it points to.

(ii)

A hard link points to the file by inode number. As such, hard links are no different than the first name of a file. There is no "real" name vs. hard link name; all hard links are equally valid names for the file. Because of this, the file you link to must actually exist and be in the same filesystem where you are trying to create the link. If you delete the original name, then the hard link still points to the same file. Because all hard links are equally valid name(s) for the file, you can not look at one and see the other names for the file; to find this, you have to go looking at every file and compare their inode number to find the other name(s) that have the same inode number.

You can tell how many names a file has from the output of ls -l. The first number after the file mode is the link count. A file with more than 1 link has other name(s) somewhere, and conversely, a file with a link count of only 1 has no (other) hard links.

Soft Links (symbolic links )

You can make links for files & folder & you can create link (shortcut) on different partition & got different inode number from original.

If real copy is deleted the link will not work.

Hard Links

For files only & you cannot create on different partition ( it should be on same partition ) & got same inode number as original

If the real copy is deleted the link will work ( because it act as original file )

A soft link can be made with ln -s, 1st you need to define the source and then you need to define the destination ( keep it mind you need to define the full path of source and destination otherwise it will not work )

A Hard link can be made with ln , 1st you need to define the source and then you need to define the destination ( keep it mind you need to define the full path of source and destination otherwise it will not work )

I have a script in /script folder name firefox

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote