Create report.current as another name for report.txt on the same filesystem.
Share the inode and data rather than copying file contents.
Which command is appropriate?
ln TARGET LINK_NAME creates a hard link by default. Both directory entries refer to the same inode and data.
Detailed explanation
ln report.txt report.currentCorrect. ln report.txt report.current creates a hard link.
ln -s report.txt report.currentIncorrect. -s creates a symbolic link.
cp report.txt report.currentIncorrect. cp creates a separate file, even when contents initially match.
mv report.txt report.currentIncorrect. mv renames or moves the existing directory entry.
Try it yourself
An example you can run in a temporary verification environment.
ln --helpExpected result
既定はhard link、--symbolicでsymbolic linkを作る説明Key points
- The default is a hard link
- The inode is shared
- It is not a content copy
Notes
- Environment: GNU coreutils 9.x/Linux
- 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.