Delete All Files And Folders In Linux

by on July 3, 2009 · 5 comments· LAST UPDATED July 3, 2010

in

How do I delete all files and folders stored in /home/jerry/movies directories under Linux operating systems?

You need to the rm command.

Open a terminal or shell (bash) prompt and type the following command to delete everything in /home/jerry/movies

 
cd /home/jerry/movies
pwd
rm -rf *

OR you can use the following single command:

 
rm -rf /home/jerry/movies/
 

Please note that all folders and files including movies will be deleted. Once deleted you will not able to get back your data. So be careful when typing rm -rf command.

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 5 comments… read them below or add one }

1 Udana May 14, 2013 at 10:12 am

~/.local/share/Trash/files# rm -rf *

Reply

2 Vivek July 3, 2013 at 5:15 pm

Thanks for the tip about deleting all files from directory. This site always helps me for Linux tips. Thanks again !!

Reply

3 Prashanth April 16, 2014 at 5:54 pm

If i want to delete a directory containing files for which i dont have the access

can i delete those files too

If yes can you share me the command

Reply

4 pankit October 14, 2014 at 8:36 am

rm -rfv nFolders/

Reply

5 Thanjayan January 22, 2015 at 9:18 am

Hi,
I am new to linux environment and using Centos 6.2 Version OS and found that some of the folder getting deleted automatically and the deleted files and folder are from recent access. How it is happening ? Do i need to change any basic settings after OS installed? Please support me to resolve this issue.

Reply

Leave a Comment

Tagged as: , , , , ,

Previous Faq:

Next Faq: