Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 12-18-2011, 07:22 AM   #1
Registered: Aug 2011
Posts: 760

Rep: Reputation: 23
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.
Old 12-18-2011, 08:04 AM   #2
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,257

Rep: Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882Reputation: 882
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.
Old 12-18-2011, 09:17 AM   #3
Senior Member
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
find /var/www -name 'myfiles' -ls
1 members found this post helpful.
Old 12-18-2011, 10:50 AM   #4
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
$ 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.
Old 12-18-2011, 08:13 PM   #5
Registered: Aug 2011
Posts: 760

Original Poster
Rep: Reputation: 23
Thanks for suggestions. The command:

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



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
command to show updates to files gustavolinux Linux - Newbie 4 11-03-2008 10:55 AM
cmake or make: debug output, show command Ephracis Programming 4 03-01-2008 03:28 AM
how to show size of files in FIND command packets Linux - General 5 04-17-2007 10:49 PM
what command can i use to find files of a certain size? abutzki Linux - Newbie 2 01-31-2006 07:43 AM
command to find size of a dir Longinus Linux - Newbie 3 08-01-2004 08:19 PM

All times are GMT -5. The time now is 03:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration