What Does rm -rf ~/* Do Again?

The following command reports the number of files in the 2006 directory, including files in all subdirectories:

find 2006 -type f | wc -l

The following command deletes all the files in the 2006 directory, including files in all subdirectories:

find 2006 -type f | xargs rm

When both commands are in your bash history (left over from when you moved the 2005 directory), you should probably be careful before hastily executing one.

One thought on “What Does rm -rf ~/* Do Again?

  1. just pixels says:

    The following command knocks some sense into careless users:

    “Tell me again how this happened.”

Leave a Reply

Your email address will not be published. Required fields are marked *