How do I get the find command to print out the file size with the file name?

Brian picture Brian · Sep 15, 2008 · Viewed 153.4k times · Source

If I issue the find command as follows:

$ find . -name *.ear

It prints out:

./dir1/dir2/earFile1.ear
./dir1/dir2/earFile2.ear
./dir1/dir3/earFile1.ear

What I want to 'print' to the command line is the name and the size:

./dir1/dir2/earFile1.ear  5000 KB
./dir1/dir2/earFile2.ear  5400 KB
./dir1/dir3/earFile1.ear  5400 KB

Answer

shyam picture shyam · Sep 15, 2008
find . -name '*.ear' -exec ls -lh {} \;

just the h extra from jer.drab.org's reply. saves time converting to MB mentally ;)