MV and RM Options Flashcards
(10 cards)
1
Q
What does mv -i do?
A
- Prompts for confirmation before overwriting existing files
- Prevents accidental data loss when moving files to locations with existing files
- Interactive mode that asks “overwrite filename? (y/n)” before proceeding
2
Q
How does mv -u work?
A
- Updates - only moves files if source is newer than destination or destination doesn’t exist
- Prevents overwriting newer files with older versions
- Useful for backup operations and synchronization tasks
3
Q
What is mv -v used for?
A
- Verbose mode - shows what files are being moved/renamed
- Provides feedback on the operation’s progress
- Helpful for confirming actions and debugging move operations
4
Q
When would you use mv -n?
A
- No-clobber mode - never overwrites existing files
- Safer than default behavior when you want to preserve existing files
- Opposite of -f (force) option
5
Q
What does mv -f accomplish?
A
- Forces the move operation without prompting for confirmation
- Overrides any interactive prompts or write protection
- Use with caution as it can overwrite files without warning
6
Q
What does rm -i do?
A
- Prompts for confirmation before removing each file
- Interactive mode that asks “remove filename? (y/n)”
- Essential safety feature to prevent accidental file deletion
7
Q
What is the purpose of rm -r or rm -R?
A
- Recursively removes directories and their contents
- Required to delete non-empty directories
- Extremely dangerous - can delete entire directory trees
8
Q
How does rm -f differ from regular rm?
A
- Forces removal without prompting, even for write-protected files
- Ignores non-existent files (no error messages)
- Bypasses confirmation prompts and permission restrictions
9
Q
What does rm -v provide?
A
- Verbose mode - shows each file as it’s being removed
- Provides feedback on deletion progress
- Useful for confirming what files are actually being deleted
10
Q
Why is rm -rf considered dangerous?
A
- Combines recursive deletion with force option
- Deletes entire directory trees without any confirmation prompts
- Can cause catastrophic data loss if used incorrectly (especially as root)