Find Files and Directories Based on Size in Linux

Find Files and Directories Based on Size in Linux

In Unix-like and some other operating systems, find is a command-line utility that searches one or more directory trees of a file system, locates files based on some user-specified criteria and applies a user-specified action on each matched file.

To find all 50MB files, use.

# find / -size 50M

Find Size between 50MB – 100MB

To find all the files which are greater than 50MB and less than 100MB.

# find / -size +50M -size -100M

Find and Delete 100MB Files

To find all 100MB files and delete them using one single command.

# find / -size +100M -exec rm -rf {} \;

Find Specific Files and Delete

Find all .mp3 files with more than 10MB and delete them using one single command.

# find / -type f -name *.mp3 -size +10M -exec rm {} \;



Find Files and Directories Based on Modification Time in Linux

Find Files by Modification Time in linux

Find Files Based on their Permissions in Linux

Find Linux Command : Basic

 

Leave a Reply