Find Files Greater Than 1GB in Linux-3

Find Files Greater Than 1GB in Linux

To find files greater than some size we use linux find command.

Syntax

find /path/...path/  -type f   -size +100M

here type -f represents file.

above command will list all files greater than 100mb in a particular path.

Ex1:

find . -type f -size +1G -exec ls -la {} \;

using this we can find the files greater than 1GB in current directory and its subdirectories. Here i added extra linux command ls -la through -exec. using this we can list the files with their sizes and permissions.

syntax to add extra linux commands is add     -exec <linux command> {} \;   at the end of find command.

and here we didn't mention depth of the files to search, so it will search all files from current directory to all its sub directories.

Find the files in the current directory only:

find . -maxdepth 1 -type f -size +100M

Here we mentioned maxdepth 1, so it will search only in the current directory it will not go through any sub directories in the current directory.

above command will search only in current directory and it will print the files more than 100 mb.

Find Files greater than 1 GB and older than 1 month

find /path -mtime +30 -size +1G

-mtime means search for modification times that are greater than 30 days (+30). And the -size parameter searches for files greater than 1G

Find and Delete the files more than 1GB

find /home -type f -size +1G -delete

we can add -delete at the end of of find command to delete the files.

  • Find Files Greater Than 1GB in Linux
  • Find Files bigger Than 1GB in Linux
  • find files size greater than 100mb in linux
  • find files more than 500mb in linux
  • shell script to check file size greater than 50mb

Leave a Reply

Your email address will not be published. Required fields are marked *