Create manual-latest.txt as another name for manual.txt on the same filesystem.
Use a hard link rather than a symbolic link.
Which command is appropriate?
ln SOURCE LINK creates another hard-link name to the same inode. Changes through either name affect the same data.
Detailed explanation
ln manual.txt manual-latest.txtCorrect. ln manual.txt manual-latest.txt adds a hard link.
Correct. ln manual.txt manual-latest.txt adds a hard link.
ln -s manual.txt manual-latest.txtIncorrect. -s creates a symbolic link.
Incorrect. -s creates a symbolic link.
cp manual.txt manual-latest.txtIncorrect. cp creates a separate inode.
Incorrect. cp creates a separate inode.
mv manual.txt manual-latest.txtIncorrect. mv renames the existing name instead of adding another one.
Incorrect. mv renames the existing name instead of adding another one.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); printf data >"$tmp/manual.txt"; ln "$tmp/manual.txt" "$tmp/manual-latest.txt"; stat -c '%i' "$tmp/manual.txt" "$tmp/manual-latest.txt"; rm -rf "$tmp"Expected result
2行で同じinode番号Key points
- ln alone creates a hard link
- The inode is shared
- The link count increases
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.