Jump to content

Finding large files on Linux distributions


Jopa

Recommended Posts

RPM Based distributions: Red Hat, Centos, Fedora
Specify path:


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

Example for specific path:

find /home/http/logs -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
 
 

Current Dir:


find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
 
 

Debian or Debian based ( Ubuntu and various other deb based distros )
Specify path:


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

Current Dir:


find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
 
 

Largest files in directory:


ls -lSh | less

du -xakh .|sort -n|tail -10

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf                 ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'

find . -type f -print0 | xargs -0 ls -lSh | head -10
 
Edited by Fearless News
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.