WARNING: Here be dragons!

If you want to outright remove a file, you'll need rm. For individual files, just specify the filename(s):

Just like cp, if you want to get a directory, you'll need -r for recursive. -i for interactive also works, and I often use it if I want to be really careful about what I'm doing.

you'll shoot your eye out!

You should always be careful with rm, and doubly so with recursive rm. It's always a good idea to make sure you know what directory you're in, where the thing you want to delete lives, and that you're sure you want to delete it.

Unlike graphical file managers, rm doesn't come with an undo button or a Trash where you can retrieve things. Once a file is gone, you will only be able to get it back at considerable effort, if at all. Tread lightly!

This guide was first published on Jan 13, 2015. It was last updated on Jan 13, 2015.

This page (Deleting Files and Directories: rm) was last updated on Jan 05, 2015.

Text editor powered by tinymce.