The rm command
Remove files or directories. Deletes files straight away: there is no bin to restore them from. A directory needs -r, which deletes everything inside it as well, so check the name before you press Enter.
Usage
rm [OPTION]... FILE...
Options
| -r, -R, --recursive | remove directories and everything in them |
|---|---|
| -f, --force | no error for files that don’t exist |
| -d, --dir | remove empty directories |
| -v, --verbose | say what was removed |
Examples
rm old.txtDelete one filerm *.tmpDelete every file ending in .tmprm -r buildDelete a folder and its contents
Learn it step by step
Related commands
learner@sandbox: ~bash (practice)
Note: Try rm here: your home directory has sample files. Press Try beside an example, or type your own.
Enter runs · Tab completes names · ↑ ↓ step through history · Ctrl+L clears · type help for every command
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.