如何获取find命令以文件名打印出文件大小? [英] How do I get the find command to print out the file size with the file name?

查看:131
本文介绍了如何获取find命令以文件名打印出文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我发出find命令,如下所示:

If I issue the find command as follows:

$ find . -name *.ear

它输出:

./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


推荐答案

find . -name '*.ear' -exec ls -lh {} \;

只是来自jer.drab.org的回复。节省时间转换为MB精神;)

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

这篇关于如何获取find命令以文件名打印出文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆