22.Centos下 du命令的使用,查看某个文件或目录占用磁盘空间的大小

本文详细介绍了Linux系统中du命令的用途、选项及其常用方法。du命令用于查看目录或文件占用的磁盘空间大小。常用选项包括-h(以人类可读格式显示)、-a(显示所有文件和目录的大小)、-s(仅显示目录总大小)等。通过示例展示了如何查看当前目录总空间、特定文件大小以及使用不同选项进行统计。du命令还可以结合--apparent-size、-c、-l和-L等选项来获取文件或目录的实际大小、总和以及链接文件的大小信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、du命令介绍

du reports the amount of disk space used by the specified files and for each subdirectory (of directory arguments). with no arguments,du reports the disk space for the current directory。

du命令用来查看目录或文件所占用磁盘空间的大小。常用选项组合为:du -sh
du 意思是 disk usage
在这里插入图片描述

二、du常用的选项

[root@localhost ftp_data]# du --help
用法:du [选项]... [文件]...
 或:du [选项]... --files0-from=F
Summarize disk usage of each FILE, recursively for directories.

Mandatory arguments to long options are mandatory for short options too.
  -0, --null            end each output line with 0 byte rather than newline
  -a, --all             write counts for all files, not just directories
      --apparent-size   print apparent sizes, rather than disk usage; although
                          the apparent size is usually smaller, it may be
                          larger due to holes in ('sparse') files, internal
                          fragmentation, indirect blocks, and the like
  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

亦良Cool

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值