linux 中实现指定类型数据仅仅显示大小 和 文件名
001、正常输出文件信息
[root@PC1 test1]# ls ## 测试文件 a.txt b.csv b.ped b.txt [root@PC1 test1]# ls -lh ## 正常输出文件信息 total 190M -rw-r--r--. 1 root root 20M Feb 9 09:12 a.txt -rw-r--r--. 1 root root 50M Feb 9 09:12 b.csv -rw-r--r--. 1 root root 20M Feb 9 09:12 b.ped -rw-r--r--. 1 root root 100M Feb 9 09:12 b.txt

。
002、
[root@PC1 test1]# ls ## 测试文本 a.txt b.csv b.ped b.txt [root@PC1 test1]# find * | xargs -n 1 ls -sh ## 仅输出文件大小和文件名 20M a.txt 50M b.csv 20M b.ped 100M b.txt

003、
[root@PC1 test1]# ls ## 测试文件 a.txt b.csv b.ped b.txt [root@PC1 test1]# ls -sh * 20M a.txt 50M b.csv 20M b.ped 100M b.txt [root@PC1 test1]# ls -sh * | xargs -n 2 ## 列出每个文件的大小和文件名 20M a.txt 50M b.csv 20M b.ped 100M b.txt

004、
[root@PC1 test1]# ls ## 测试文件 a.txt b.csv b.ped b.txt [root@PC1 test1]# du -sh 190M . [root@PC1 test1]# du -sh * ## 列出文件的大小和文件名 20M a.txt 50M b.csv 20M b.ped 100M b.txt

。

浙公网安备 33010602011771号