data and data-backup are hard links to one regular file with link count 2.
Run rm data.
What is true about data-backup?
rm removes one name from the inode. The remaining hard link still reaches the data and the link count becomes 1.
Detailed explanation
Incorrect. The inode remains while data-backup refers to it.
Incorrect. The inode remains while data-backup refers to it.
Correct. data-backup still reads the same data and the count is now 1.
Correct. data-backup still reads the same data and the count is now 1.
Incorrect. A hard link does not become symbolic automatically.
Incorrect. A hard link does not become symbolic automatically.
Incorrect. The filesystem does not copy data to a new inode automatically.
Incorrect. The filesystem does not copy data to a new inode automatically.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); printf payload >"$tmp/data"; ln "$tmp/data" "$tmp/data-backup"; rm "$tmp/data"; printf '%s %s\n' "$(cat "$tmp/data-backup")" "$(stat -c '%h' "$tmp/data-backup")"; rm -rf "$tmp"Expected result
payload 1Key points
- rm unlinks a name
- The remaining hard link preserves data
- The link count decreases
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.