什么命令会给我目录中所有文件(包括子文件夹)的完整路径和文件大小的列表?
我能去的最接近的是:
ls -alR /test | grep ^- | awk '{print $5 "\t " $9}'
想要的结果(尺寸也可以在右侧):
123 /test/fileA
4534 /test/fileB.sh
3456 /test/fileC.py
123 /test/log/mon.txt
4534 /test/log/tue.txt
3243456 /test/man/manual.odt
请在下面找到解决方案,并在下面进行解释
kalou@shinwey:~$ find /etc/lynx /etc/pulse -type f -printf "%s\t%p\n" | head
162929 /etc/lynx/lynx.cfg
3581 /etc/lynx/lynx.lss
116 /etc/pulse/client.conf.d/00-disable-autospawn.conf
4933 /etc/pulse/default.pa
2078 /etc/pulse/system.pa
2374 /etc/pulse/daemon.conf
1201 /etc/pulse/client.conf
如你看到的,
find
接受目录列表作为查找文件的输入。查找文件是使用该-type f
选项实现的。您可以使用-printf
(man printf
也可能有帮助)自定义查找输出
顺便说一句:当你在这里提问时,请表明你已经努力解决问题,以及失败的地方。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句