How to Delete Multiple Files in Linux?

Follow the below given commands to delete multiple files in Linux.

#1. Command to delete multiple files

rm -v filename1 filename2 filename3

#2. Command to delete multiple files accessed before

find . -type f ! -newerat 'dd/mm/yyyy 17:24:00' -exec rm -f {} \;
find path/of/the/file -type f -mtime +30 -delete 

#3. Command to delete multiple files with same keyword

rm -v keyword*
find -type f -name '*keyword*' -delete

#4. Command to delete multiple files of same extension

find path/of/the/file -type f -name "*.php" -exec rm -f {} \;
find path/of/the/file -name "*.php" -type f -mtime +30 -delete 

#5. Command to delete files of certain size

find path/of/the/file -type f -size +70M -exec rm -f {} \;
find path/of/the/file -type f -size -5M -exec rm -f {} \;
That's It !
Check out the blog to get detailed explaination of the above mentioned commands.
  • delete a range of files in Linux, how to remove multiple files using command line, remove multiple files in Linux, how to delete multiple files having same keyword in filename, how to delete multiple files in Linux at once, how to delete multiple files accessed before particular date and, how to delete multiple files with sane extension, delete multiple files in Linux
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What are some Basic SSH commands?

List of some basic SSH commands are: ls – This command is used to list all files and...

How to connect to SSH?

Putty is an open-source SSH client used to connect to a remote server. This article describes how...

20 Basic Linux Commands and their Uses.

Following are the top 20 basic Linux Commands with Live Examples that would definitely help you...

How to Block/Unblock IPs from SSH?

You can easily block or unblock IPs  from SSH. #1. Block An IP Address from SSH First of all,...

How to install CpCleaner in cPanel through SSH?

CpCleaner is a cPanel plugin created to give cPanel users the option to clean junk files that...