If you wish to remove a file or folder within your Linux system you can use the rm command. In this article, we’ll show the basic usage of the Linux rm Command.
Delete a file using Linux rm command
rm myFile.txt
Delete recursively using Linux rm -r
When you wish to delete all files and directories you can use rm -r
rm -r /directory/
Delete a file without asking for permission
rm -f myFile.txt
Delete a file using WildCard
This will delete all .txt files
rm -f *.txt
Delete all files and the directory
rm -rf /path/to/directory
Delete file and display information
rm -v myFile.txt
Delete file while being prompted for it
rm -i myFile.txt