Here are some commonly used options with the rm command:
-
-f: Force removal of files without prompting for confirmation, even if the files are write-protected.rm -f filename.txt -
-ror-R: Recursively remove directories and their contents. This is necessary when you want to delete a directory that contains files or other directories.rm -r directory_name -
-v: Verbose mode. This option will show you what files are being removed as the command is executed.rm -v filename.txt -
--preserve-root: Prevents accidental removal of the root directory (/). This is a safety feature.rm --preserve-root -r / -
--interactive: Similar to-i, it prompts for confirmation before each removal. You can also specify--interactive=onceto prompt only once for all files.rm --interactive filename.txt -
--no-preserve-root: Allows the removal of the root directory when using-r. Use with caution.rm --no-preserve-root -r /
Always use the rm command with caution, especially with options like -f and -r, as they can lead to permanent data loss.
