edited by
4,105 views
9 votes
9 votes

A student wishes to create symbolic links in a computer system running Unix. Three text files named $``\text{file 1}", ``\text{file 2}"$ and $``\text{file 3}"$ exist in her current working directory, and the student has read and write permissions for all three files. Assume that $\text{file 1}$ contains information about her hobbies, $\text{file 2}$ contains information about her friends and $\text{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
edited by

2 Answers

Best answer
14 votes
14 votes

Correct option: B

As ln -s is a symbolic link. In this case

File$3 \Rightarrow$ File$2 \Rightarrow$ File$1 \Rightarrow$ Hobbies (actual data).

So File$2$ and File$3$ contents are lost.

edited by
8 votes
8 votes
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.
Answer:

Related questions