Determine whether report and report-copy are hard links or separate copies.
Display inode numbers together with long-format attributes.
Which command is appropriate?
Hard-linked names share an inode number. ls -li displays inode numbers and long-format metadata together.
Detailed explanation
ls -l report report-copyIncorrect. Long format alone does not display inode numbers.
Incorrect. Long format alone does not display inode numbers.
ls -F report report-copyIncorrect. -F classifies names and does not show inodes.
Incorrect. -F classifies names and does not show inodes.
ls -li report report-copyCorrect. ls -li report report-copy displays inode numbers for comparison.
Correct. ls -li report report-copy displays inode numbers for comparison.
ls -s report report-copyIncorrect. -s displays allocated blocks, not inode numbers.
Incorrect. -s displays allocated blocks, not inode numbers.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); touch "$tmp/report"; ln "$tmp/report" "$tmp/report-copy"; ls -li "$tmp/report" "$tmp/report-copy"; rm -rf "$tmp"Expected result
両行のinode番号が同じで、リンク数が2Key points
- -i is inode
- -l is long format
- Hard links share an inode
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.