How To Delete the Contents of a Linux Directory

April 2018

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/*  

Image: © quka -
Published by aakai1056. Latest update on December 3, 2017 at 03:38 PM by owilson.
This document, titled "How To Delete the Contents of a Linux Directory," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (
Ubuntu - CodeBlocks does not compile
Problem with sound on EeePC 701