rm command in UNIX
rm [OPTION]... [FILE]...Introduction
Section titled “Introduction”rm removes each specified file. By default, it does not remove directories.
If you need to remove a directory (below called DIRECTORY) and all its content you can’t use rmdir so you need to use this command:
rm -rf DIRECTORYBE CAREFUL: you could delete your whole file system if you specify ‘./’ as DIRECTORY.
Options
Section titled “Options”The most useful options are:
-f,--force: ignore nonexistent files and arguments, never prompt-i: prompt before every removal (typeyto confirm,nto deny)--no-preserve-root: do not treat'/'specially (very dangerous)-r,-R,--recursive: remove directories and their contents recursively-v,--verbose: explain what is being done (common to lots of commands)
Examples
Section titled “Examples”The command above is often used to remove node_modules folder when working on a Node.js project.
rm -rf node_modules/
# if you hate yourself, use the verbose moderm -rfv node_modules/Quotes
Section titled “Quotes”Manual reference: