Deleting files#
Uh oh! Jess doesn't actually like the idea of her age being known in that file of ours, so she's asked us to delete that information. Being respectful of another person's privacy is important, we let's delete the file to honour Jess' request: rm jess.txt
. The rm
command, as you might have guessed, means remove
(man rm
).
I now get:
1 2 3 |
|
Now we have no friends again. We may as well delete the directory, too:
1 2 3 |
|
Huh? It turns out that friends/
is indeed a directory, as we know, and so we can't use rm
without providing a few additional flags to "force" it to delete a directory: rm -r friends
. Now it's gone.
The -r
flag to rm
means recursive
, and it means: delete this item and everything inside of it by recursing into the directory and deleting everything you find... scary. That's why it must be used with care. Use man rm
to see more.