Software & Apps Linux Example Uses of the Linux Command rm Delete files from the Linux command line by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on February 16, 2020 gdainti / Getty Images Linux Switching from Windows Tweet Share Email The "rm" command is used for deleting a file or directory (folder). The command name "rm" is derived from "remove". The rm command doesn't have a trash/recycling bin. Once you delete something with rm, it's gone permanently. To remove the file "accounts.txt" in the current directory you would type: rm accounts.txt Removing a directory requires an additional option, the '-r' switch. It tells your computer to remove files recursively, meaning you'll delete your the folder and everything in it. To remove a folder in your current directory, run: rm -r folder In order to delete a file that is not in the current directory, you can specify the full path. For example, rm /home/jdoe/cases/info.txt You can selectively delete a subset of files using the wildcard character "*". The example below would delete all files that end in ".txt" in your current directory. rm *.txt Think twice before using "rm". The system may immediately remove the specified files without giving you chance to confirm. And there is no "garbage can" where you can go to retrieve deleted items.