rm
Delete files and folders
What it does
rm deletes files. The terminal has no trash: what you delete cannot be brought back by ordinary means.
Folders are deleted with -r, together with everything inside. -i asks for confirmation for every file, while -f does the opposite: no questions, and no complaints about missing files.
Careful. rm deletes for good, with no trash. Take special care with rm -rf and patterns like *: first check what they match by running ls with the same argument.
Syntax
rm <file>…
rm -r <folder>
rm -i <file>Examples
Delete the file notes.txt
rm notes.txtrm— remove (there is no trash bin!)notes.txt— file
Delete the build folder with everything in it
rm -r buildsame as:
rm -R build,rm --recursive buildrm— remove-r— recursively — needed for foldersbuild— folder