深度阅读

How do I display the file size in human-readable format using the ls command in Linux?

作者
作者
2023年08月22日
更新时间
8.84 分钟
阅读时间
0
阅读量

To display the file size in human-readable format using the ls command in Linux, you can use the -h option with the -l (long format) option. Here is an example command that will display the file size(s) for a given directory or file in a human-readable format:

ls -lh filename_or_directory

This will display the file sizes in a format that is easy to read by humans, using units such as “K” for kilobytes, “M” for megabytes, “G” for gigabytes, and so on. Another option is to use the -s option along with -h to display the size of each file, while still retaining the human-readable format. Here is an example command using both options:

ls -lsh filename_or_directory

This will display the size of each file or directory in the current directory in a human-readable format, along with other information such as the file permissions, ownership, etc.

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。