Learn to remove files and directories at the Linux command line.
Linux rm command summary with examples (3:54)
Videos can also be accessed from the YouTube Playlist.
Our twenty-fifth word, or command to memorize is
rm from our category
rm allows you to remove files or
Recall from the last video (tutorial) we moved files around? Now we'll learn how to delete them.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
rm command has
12 options and arguments are the files or directories
you'd like to delete permanently.
Like most commands, help is available with double-dash
Just as with
mv before it, the
-i, or interactive mode, will
prompt you before removing files. The default is to delete silently
Also to delete directories, you'll need the
-r, recursive option, and with
-v you see confirmations of actions
So why is
rm an important command?
rm is required to delete
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go, let's open the directory where we keep our stuff
cd stuff and do a
Let's say we had second thoughts about how we'd like to organize this,
ls these directories.
Two empty directories. Okay, let's use
rm -i to remove
Oh yeah, we need
-r to remove
directories. Hey, while we're at it,
let's delete two at once and include
And there's our reminder, are we sure? Yep.
Very good. Gone forever.
And last, let's move
up one directory and remove
as well using
rm -irv again just to
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
rm is such a potentially
harmful command, I suggest habitually including the
-i option. And look at that 25 commands
down, one-quarter of the way through. Very good.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Subscribe to our YouTube Channel from here to get that one-two punch: video plus text.
mvcommand, hit Back.
wccommand, click Next.