A system administrator needs to create a reference to /data/reports/quarterly.log from a user's home directory at ~/logs/q1.log. A critical requirement is that if the original file at /data/reports/quarterly.log is removed, the data must remain accessible through ~/logs/q1.log. Which of the following commands will fulfill this requirement?
The correct command is ln /data/reports/quarterly.log ~/logs/q1.log. By default, the ln command creates a hard link. A hard link is a directory entry that points directly to the same inode as the original file. The file's data is only removed from the disk when the last hard link (or file name) pointing to its inode is deleted. Therefore, if the original file name is removed, the hard link will still point to the inode, and the data will remain accessible.
ln -s /data/reports/quarterly.log ~/logs/q1.log creates a symbolic (or soft) link. A symbolic link points to the original file's path, not its inode. If the original file is removed, the symbolic link will become a broken or dangling link, and the data will be inaccessible.
cp /data/reports/quarterly.log ~/logs/q1.log creates an independent copy of the file. While this would preserve the data if the original were deleted, it is not a link. It duplicates the data, consuming additional disk space, and any changes to one file would not be reflected in the other.
mv /data/reports/quarterly.log ~/logs/q1.log moves (renames) the file. It does not create a second reference to the file; it simply changes the existing file's location and/or name.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between a hard link and a symbolic link?
Open an interactive chat with Bash
What is an inode in Linux?
Open an interactive chat with Bash
Why doesn't the `cp` command satisfy the requirement in this scenario?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access