DEV Community

Cover image for Living in the Shell #13; rm (Delete Files/Directories)
Babak K. Shandiz
Babak K. Shandiz

Posted on • Originally published at babakks.github.io on

Living in the Shell #13; rm (Delete Files/Directories)

rm 💣

Removes files or directories.

💀 Removal is irreversible.

Remove a single file

rm some-file
Enter fullscreen mode Exit fullscreen mode

Remove multiple files

rm first-file second-file third-file
Enter fullscreen mode Exit fullscreen mode

Remove a directory -r

rm -r my-dir
Enter fullscreen mode Exit fullscreen mode

Set to prompt before every removal -i

rm -ri my-dir
Enter fullscreen mode Exit fullscreen mode

Set to suppress any interaction/error -f

rm -rf my-dir my-non-existing-dir
Enter fullscreen mode Exit fullscreen mode

Top comments (0)