Comments on Linux rm Command Explained for Beginners (8 Examples)

Deleting files is a fundamental operation, just like copying files or renaming/moving them. In Linux, there's a dedicated command - dubbed rm - that lets you perform all deletion-related operations.

2 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Artegor

Awesom examples, thank you

By: john

I see lots of cases where rm is used as this: rm -rf dirName ... but rarely do I see cases where you're in one location and want to delete a directory and it's subs at another location. Is this done as: rm -rf /startBase/sub1/sub2

So in the case above, the entire sub2 tree is deleted, including empty directories? Or do I have to close sub2 like this: /.../sub2/ or add an asterisk, like this: /.../.../sub2/*