Delete All Files And Folders In Linux

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

You need to the rm command.

ADVERTISEMENTS

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.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
6 comments… add one
  • Udana May 14, 2013 @ 10:12

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

  • Vivek Jul 3, 2013 @ 17:15

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

  • Prashanth Apr 16, 2014 @ 17:54

    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

    • pankit Oct 14, 2014 @ 8:36

      rm -rfv nFolders/

  • Thanjayan Jan 22, 2015 @ 9:18

    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.

  • Victor Mar 7, 2017 @ 7:03

    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.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.