Linux: listar archivos en funcion del tamaño usando find

Aplicable a CentOS

Cómo listar todos los archivos de nuestro linux en función del tamaño?

Ejemplos:
1.- Listar todos los archivos de la máquina que su tamaño sea mayor de 2.0Mb

> find / -type f -size +2000k -exec ls -lisah {} ;


Resultado:

175498 2.4M -rwxr-xr-x 1 root root 2.4M Mar 31  2010 /usr/bin/smbcacls
177193 2.7M -rwxr-xr-x 1 root root 2.7M Sep 19  2009 /usr/bin/vim
173582 2.6M -rwxr-xr-x 1 root root 2.6M Mar 31  2010 /usr/bin/php-cgi
174150 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/bin/smbpasswd
178323 2.6M -rwxr-xr-x 1 root root 2.6M Mar 31  2010 /usr/bin/php
174145 2.8M -rwxr-xr-x 1 root root 2.8M Mar 31  2010 /usr/bin/net
175497 2.5M -rwxr-xr-x 1 root root 2.5M Mar 31  2010 /usr/bin/rpcclient
177450 3.6M -rwxr-xr-x 1 root root 3.6M Apr  3  2010 /usr/bin/crash
174149 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/bin/smbcquotas
175500 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/bin/smbget
174627 3.1M -r-xr-xr-x 1 root root 3.1M Apr  3  2010 /usr/lib/liblvm2cmd.a.2.02
396091 2.0M -rwxr-xr-x 1 root root 2.0M May 24  2008 /usr/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so
329857 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/lib/dri/tdfx_dri.so
329851 2.4M -rwxr-xr-x 1 root root 2.4M Mar 31  2010 /usr/lib/dri/mga_dri.so
329848 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/lib/dri/i810_dri.so
329854 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/lib/dri/r300_dri.so
329856 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/lib/dri/savage_dri.so
329850 2.5M -rwxr-xr-x 1 root root 2.5M Mar 31  2010 /usr/lib/dri/i965_dri.so
329849 2.4M -rwxr-xr-x 1 root root 2.4M Mar 31  2010 /usr/lib/dri/i915_dri.so
329855 2.4M -rwxr-xr-x 1 root root 2.4M Mar 31  2010 /usr/lib/dri/radeon_dri.so
329852 2.3M -rwxr-xr-x 1 root root 2.3M Mar 31  2010 /usr/lib/dri/r128_dri.so
...



2.- Listar todos los archivos mas grandes de 2.0Mb y que solamente muestre el tamaño y la ruta:

> find / -type f -size +2000k -exec ls -lisah {} ; | awk '{print $9 ": " $11}'

Resultado:

2.4M: /usr/bin/smbcacls
2.7M: /usr/bin/vim
2.6M: /usr/bin/php-cgi
2.3M: /usr/bin/smbpasswd
2.6M: /usr/bin/php
2.8M: /usr/bin/net
2.5M: /usr/bin/rpcclient
3.6M: /usr/bin/crash
2.3M: /usr/bin/smbcquotas
2.3M: /usr/bin/smbget
3.1M: /usr/lib/liblvm2cmd.a.2.02
2.0M: /usr/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so
2.3M: /usr/lib/dri/tdfx_dri.so
2.4M: /usr/lib/dri/mga_dri.so
2.3M: /usr/lib/dri/i810_dri.so
2.3M: /usr/lib/dri/r300_dri.so
2.3M: /usr/lib/dri/savage_dri.so
2.5M: /usr/lib/dri/i965_dri.so
2.4M: /usr/lib/dri/i915_dri.so
2.4M: /usr/lib/dri/radeon_dri.so
2.3M: /usr/lib/dri/r128_dri.so
...


Leave a Reply

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