Create current.conf pointing to releases/v2/app.conf.
Store the target path in a symbolic link.
Which command is appropriate?
ln -s TARGET LINK_NAME creates a symbolic link containing the target path string.
Detailed explanation
ln releases/v2/app.conf current.confIncorrect. Without -s, ln creates a hard link.
Incorrect. Without -s, ln creates a hard link.
ln -s releases/v2/app.conf current.confCorrect. ln -s releases/v2/app.conf current.conf creates the symbolic link.
Correct. ln -s releases/v2/app.conf current.conf creates the symbolic link.
cp -a releases/v2/app.conf current.confIncorrect. cp -a copies the file rather than storing a link target.
Incorrect. cp -a copies the file rather than storing a link target.
readlink releases/v2/app.conf current.confIncorrect. readlink reads an existing link and does not create one.
Incorrect. readlink reads an existing link and does not create one.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); mkdir -p "$tmp/releases/v2"; touch "$tmp/releases/v2/app.conf"; (cd "$tmp" && ln -s releases/v2/app.conf current.conf && readlink current.conf); rm -rf "$tmp"Expected result
releases/v2/app.confKey points
- -s means symbolic
- The link stores the target
- readlink can inspect it
Notes
- Environment: Linux / GNU coreutils 9.x / 一時ディレクトリ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.