How To Delete the Contents of a Linux Directory?

You may find yourself frustrated if, under Linux, you can’t locate the command to erase the contents of a folder without deleting the file read itself.

This FAQ will show you how to do so.

Erasing the Contents of a Linux Folder

Go to the directory, and enter:

rm -rf *

Alternatively, you can enter:

rm -rf your_directory/*

 

Leave a Reply

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