Tuesday, November 3, 2015

How to find larger file under Linux

List All Large Files

To finds all files over 1G in size and display their names, along with size, use following syntax:

Syntax for RedHat / CentOS / Fedora Linux

find {/path/to/directory/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' 

        # find / -type f -size +1G -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'



Search or find big files Linux (50MB) in current directory, enter:
            $ find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Syntax for Debian / Ubuntu Linux

find {/path/to/directory} -type f -size +{file-size-in-kb}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
Search in current directory:
           $ find . -type f -size +1G -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

Sample output:
./.kde/share/apps/akregator/Archive/http___blogs.msdn.com_MainFeed.aspx?Type=AllBlogs.mk4: 91M
./out/out.tar.gz: 828M
./.cache/tracker/file-meta.db: 101M
./ubuntu-8.04-desktop-i386.iso: 700M
./vivek/out/mp3/Eric: 230M

No comments: