LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to make find command show size of files also (http://www.linuxquestions.org/questions/linux-general-1/how-to-make-find-command-show-size-of-files-also-919313/)

rng 12-18-2011 08:22 AM

how to make find command show size of files also
 
How can I make find command to show size of files also? Do I need to use -exec ls -l or xargs etc?

Thanks for your help.

tronayne 12-18-2011 09:04 AM

You can use either -exec or pipe the found list into xargs. Piping to xargs may be a little faster but on modern systems that really doesn't matter too much; the -exec on older, slower, less RAM, etc. systems would be slower than the pipe.

Six of one...

Hope this helps some.

lithos 12-18-2011 10:17 AM

Code:

find /var/www -name 'myfiles' -ls

Telengard 12-18-2011 11:50 AM

Code:

$ find -type f -exec du -b {} \;
255    ./b.txt
125    ./bash-functions
729    ./a.txt
952    ./foo

If you want sizes in multiples of block-size, kilobytes, kibibytes, or whatever then see the du manpage and Block size - GNU Coreutils.

rng 12-18-2011 09:13 PM

Thanks for suggestions. The command:

Code:

$ find -type f -exec du -h {} \;
is working well for me (-h for human readable form).


All times are GMT -5. The time now is 11:46 PM.