010-150 · Question #71
You have a program called /usr/bin/foo. You wish to create a symbolic link, /home/user/foo, that points to it. Which command will do this task?
The correct answer is B. ln -s /usr/bin/foo /home/user/foo. The ln -s command creates a symbolic link. The correct syntax is 'ln -s TARGET LINK_NAME', placing the existing target path before the new link path.
Question
You have a program called /usr/bin/foo. You wish to create a symbolic link, /home/user/foo, that points to it. Which command will do this task?
Options
- Aln -sym /home/user/foo /usr/bin/foo
- Bln -s /usr/bin/foo /home/user/foo
- Cln /home/user/foo /usr/bin/foo
- Dln /usr/bin/foo /home/user/foo
- Eln --symlink /home/user/foo /usr/bin/foo
How the community answered
(23 responses)- A4% (1)
- B83% (19)
- C4% (1)
- E9% (2)
Why each option
The ln -s command creates a symbolic link. The correct syntax is 'ln -s TARGET LINK_NAME', placing the existing target path before the new link path.
'-sym' is not a valid option for the ln command; the correct flag for a symbolic link is '-s'.
The -s flag tells ln to create a symbolic (soft) link rather than a hard link. The argument order is 'ln -s TARGET LINK_NAME', so 'ln -s /usr/bin/foo /home/user/foo' correctly creates /home/user/foo as a symlink pointing to /usr/bin/foo.
This inverts the argument order and omits -s, which would attempt to create a hard link with source and destination reversed.
Omitting -s creates a hard link rather than a symbolic link, which does not satisfy the requirement.
'--symlink' is not a recognized long option for ln; the correct long form is '--symbolic'.
Concept tested: Creating symbolic links with ln -s
Source: https://www.man7.org/linux/man-pages/man1/ln.1.html
Topics
Community Discussion
No community discussion yet for this question.