深度阅读

How to find the size of a file in Linux using the du command?

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

To find the size of a file in Linux using the du command, you can use the following command:

du -h file_name

Here, -h stands for “human-readable” and will display the file size in a human-readable format, such as KB or MB, rather than the default block size used by the du command.

For example, to find the size of a file named example.txt in your current directory, you can run:

du -h example.txt

This will output the size of the file in a human-readable format, such as “5.5K” or “2.1M”.

Note that the du command is typically used to find the sizes of directories and their contents, but it can also be used for individual files by specifying the file name as an argument. Additionally, the -h option may not be available on all versions of du.

相关标签

博客作者

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