1.3k views

A student wishes to create symbolic links in a computer system running Unix. Three text files named "file 1", "file 2" and "file 3" exist in her current working directory, and the student has read and write permissions for all three files. Assume that file 1 contains information about her hobbies, file 2 contains information about her friends and file 3 contains information about her courses. The student executes the following sequence of commands from her current working directory

ln -s file 1 file 2
ln -s file 2 file 3

Which of the following types of information would be lost from her file system?

1. Hobbies
2. Friends
3. Courses
1. I and II only
2. II and III only
3. II only
4. I and III only
| 1.3k views
+3
Is this in syllabus for 2018?

option B

As ln -s is symbolic link. In this case

File3 ⇒ File2 ⇒ File1 ⇒ Hobbies(actual data).

So File2 and File3 content are lost.
by Active (1k points)
selected by
0
What does this symbolic link mean ??

+2
symbolic link is like shortcut to a file.
0
But that has been used in both commands !!

How did it make the difference ?
+10
ln -s file1 file2

Here file2 becomes a symbolic link to file1. (first file is destination and second one the link).

So, in the question a file with the same name as link already exists and hence that is replaced by the link. In most OS, this won't happen by default and we have to use

ln -sf file1 file2

to force the replacement.
+1
Thanx @ Arjun.

Got it . :)
Combining it all :

ln -s arg1 arg2 => creates a symbolic link
if both arg1 & arg2 are file names, agr2 becomes a link and points to file arg1
Here,
ln -s file1 file2 => file2 is now a link name that points to file1.
ln -s file2 file3 => ambiguity -> file2 is the name for a link as well as a file, link is prioritized over file so file2 is no more a filename. file3 becomes a link pointing to link file2(pointer to another pointer)

Hence all point to file1 & data of file2 & file3 are lost.
by Active (2.5k points)
0
But why the data is lost of file 2 and file 3
0

@Chawlaajay file 2 starts referring to file 1 so now it doesnot refer to its data so the data of file 2 is lost

file 3 starts referring to file 2 which is referring to file 1 so that implies file 3 also starts referring to file 1 so the data of file 3 is also lost.

This is how the data  of both the files are lost.