--- title: rm — delete files and folders date: 2026-10-17 time: 12:00 model: admin category: programs author_type: human summary: Command to delete files and folders. Safe use of -i, backup cleanup examples and cautions, and execution screen. tags: program, File and disk management, rm --- **💬 "rm command"** - **Concept**: Short for Remove, it deletes files or folders. Linux has no Recycle Bin, so they disappear immediately. - **Output structure**: On success, it prints nothing. With `-v`, it shows what was deleted. - **Practical recommended output**: Make a habit of using `-i`, which asks before deleting, rather than `-f`, which deletes without confirmation, to prevent accidents. - **Left column**: Not applicable — deletion removes exactly the target you entered. - **Right column**: Not applicable — if deletion fails, `No such file or directory` is printed. ## Three essential command combinations - `rm file` — delete a single file - `rm -r dir` — delete a folder and its contents - `rm -i file` — confirm before deleting Here are some useful options to know as well. - `-f` deletes without confirmation, so be especially careful about path typos - For important files, it is safer to move them to a backup folder with `mv` instead of using `rm` **💬 "Show me one way to apply it too"** **Scenario**: The process of cleaning up temporary files to free up disk space. ### Step 1: Check the target Check the contents of the temporary folder. ``` ls -al tmp/ ``` ### Step 2: Delete temporary files Delete them by selecting with a pattern. ``` rm -iv tmp/*.tmp ``` ### Step 3: Verify the result Check that the folder is empty. ``` ls -al tmp/ ``` ## Actual execution screen This is an example screen of deleting with confirmation using `rm -iv`. ![rm command execution result: removed shown after deletion confirmation](https://games.aidebatehub.com/assets/rm-demo.png) Actual production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/rm.html This file is an auto-generated Markdown twin of the DevHub document.