During packaging you install the program binary at /opt/widget-4.0/bin/widget. To keep the image relocatable you must create a relative symbolic link called /usr/local/bin/widget that will continue to work even if the whole directory tree is moved to another location (for example into a chroot). Which single command meets this requirement in one step?
The -s option tells ln to create a symbolic (soft) link instead of the default hard link, which is necessary because the source and destination may end up on different file systems. Adding -r (or --relative) makes ln rewrite the absolute source path into a path that is relative to the link's own location, so the link continues to work after the directory tree is moved anywhere that preserves the internal layout. Without -r, the link would store the absolute path /opt/widget-4.0/bin/widget, breaking as soon as the image is relocated. Using -r by itself is an error (it is only valid together with -s), and manually typing a relative path that begins with ../../ is wrong because it does not climb far enough from /usr/local/bin back to the file-system root. Therefore the command that satisfies all conditions is the one that combines -s and -r.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a symbolic (soft) link in Linux?
Open an interactive chat with Bash
What is the purpose of the `-r` option in the `ln` command?
Open an interactive chat with Bash
Why is using a manually typed relative path (like `../../`) incorrect in this context?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access