Working in /home/carol, you run `ln -s ../shared/data.csv /srv/app/data.csv`. Which file will /srv/app/data.csv resolve to when a program opens it?

LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard hard

Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.

Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

The options

Correct /srv/shared/data.csv

Correct. The relative target is stored verbatim and interpreted against the directory holding the link, /srv/app, so ../shared/data.csv means /srv/shared/data.csv.

Not correct /home/shared/data.csv

Wrong. That would be the result if ln resolved the target against the current working directory at creation time. It does not: the string is stored as given and resolved only when the link is followed.

Not correct /srv/app/shared/data.csv

Wrong. This treats the leading ../ as though it were absent. The .. component is a real directory entry and moves the lookup one level up from /srv/app.

Not correct Nothing, because ln refuses to create a link whose target does not exist relative to the current directory

Wrong. ln -s performs no check on the target at all; creating a dangling symbolic link is legal and often deliberate, for example when the target will appear later.

Why

A symbolic link stores its target as an uninterpreted string. When the link is followed, a relative target is resolved against the directory that contains the link, never against the process's working directory at creation time. That is why relative symlinks survive the whole tree being moved or copied, and it is also why they break when only the link is moved. GNU ln -r computes such a relative target for you from an absolute path you supply.

Where this comes from

Cited
manual page symlink(7)

Practise this

Reading one question is not practice. The trainer will draw a short set from objective 104 and space the ones you get wrong.

Practise LPIC-1 Exam 101-500

More questions on this objective

All questions on Devices, Linux filesystems, filesystem hierarchy standard

Practise LPIC-1 Exam 101-500