Bash-如何列出大小以字节为单位的文件 [英] Bash - how to list files with size in bytes

查看:40
本文介绍了Bash-如何列出大小以字节为单位的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ls命令将文件输出到目录中,但是我需要以字节为单位的文件大小.

I am wanting to use the ls command to output the files in a directory however I need the file size in bytes.

使用ls命令可以吗?

在类似的问题上,我发现此 ls -l --block-size = M 可以输出以兆字节为单位的文件大小,但是我似乎无法让它仅以字节为单位工作.

on similar questions i've found this ls -l --block-size=M which outputs the file size in megabytes however I cannot seem to get it to work with just bytes.

推荐答案

如果要查找有关文件的统计信息,则要使用 stat 而不是 ls .例如:

If you are looking for statistics about files, then you want to use stat rather than ls. eg:

stat --format=%n:%s *

这篇关于Bash-如何列出大小以字节为单位的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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