Delete All Files And Folders In Linux

last updated in Categories

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.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

6 comment

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

  2. 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

  3. 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.

  4. Hi

    how do we delete files in a hidden directory on startup

    What I am trying to accomplish here is in my system I have android sdk installed but it gives device unauthorized …. I found a solution which asks me kill the adb server using adb kill-server to delete all files in /home/user/.android which i do by cd /home/user/.android/ and rm -rf *

    I wrote this in sequence up in /home/user/.profile file but except for adb kill-server nothing worked

    I also tried rm -rf /home/user/.android/* too in the . profile file but again no result. I thought sudo might be missing but using it too no result.

    Have a question? Post it on our forum!