The rm command is used to remove files and directories from the file system.
- About rm: To remove files or directories
- Comes From: coreutils-8.4
- Configuration Files:
- Path: /bin/rm
Examples:
1. To remove a file
$ rm file |
2. To forcefully remove a file
$ rm -f file |
3. To prompt before removing any file
$ rm -i file |
4. To prompt before removing any file, if more than three files
$ rm -I file* |
5. To prmpt as specified
$ rm –interactive=WHEN file* |
6. To skip any directory that is on a file system different from specified
$ rm –one-file-system |
7. To do not treat “/” specially
$ rm –no-preserve-root |
8. To do not remove “/”
$ rm –preserve-root |
9. To remove directories and their contents recursively
$ rm -r, $ rm -R $ rm –recursive |
10. To run in verbose mode
$ rm -v $ rm –version |
11. To get the help
$ rm –help |
12. To get the version
$ rm –version |
Related Command: unlink, chattr, shred