在Linux中,du命令用于查看目录中文件和子目录的磁盘使用情况
du -ah --exclude='file_pattern' /path/to/directory
其中:
-a:显示所有文件和目录的磁盘使用情况。-h:以人类可读的格式(如KB、MB)显示磁盘使用情况。--exclude='file_pattern':排除匹配指定模式的文件。例如,要排除名为temp.log和所有以.tmp结尾的文件,可以使用--exclude='temp.log' --exclude='*.tmp'。/path/to/directory:要检查的目录路径。请注意,将file_pattern替换为要排除的文件或目录的匹配模式。如果需要排除多个文件或目录,可以使用多个--exclude选项,如下所示:
du -ah --exclude='file_pattern1' --exclude='file_pattern2' /path/to/directory