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 Tweet Share Email Linux Switching from Windows 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. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up. Tell us why! Other Not enough details Hard to understand Submit