You are writing a weekly cleanup script that runs as root and executes rm -r /var/build/* to remove build artifacts. The /var/build directory may occasionally contain bind-mounted sub-directories that live on a different filesystem (for example, a developer's /home). To guarantee that the recursive deletion never crosses onto those other filesystems, which single additional rm option should you include in the command?
--one-file-system makes rm compare the device ID of every directory it is about to descend into with the device ID of the original command-line argument. If they differ, the directory is skipped, so the deletion remains confined to the initial filesystem. --preserve-root=all only refuses to delete command-line arguments that are on a different device from their parent, --no-preserve-root removes the built-in protection for /, and -I merely prompts once before a large or recursive removal without restricting filesystem traversal.
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 does the --one-file-system option do in Linux?
Open an interactive chat with Bash
How does the rm command determine different filesystems with --one-file-system?
Open an interactive chat with Bash
What is the purpose of the --preserve-root=all option in rm?
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