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

前端 未结 15 555
无人及你
无人及你 2020-12-07 11:01

If I issue the find command as follows:

$ find . -name *.ear

It prints out:

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


        
15条回答
  •  遥遥无期
    2020-12-07 11:48

    You could try this:

    find. -name *.ear -exec du {} \;
    

    This will give you the size in bytes. But the du command also accepts the parameters -k for KB and -m for MB. It will give you an output like

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

提交回复
热议问题