disk-usage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDisk Usage Skill
磁盘使用Skill
Analyzes disk space and filesystem usage on Linux systems.
分析Linux系统上的磁盘空间和文件系统使用情况。
Suggested Workflow
建议工作流程
- Run for a structured overview of mounts, block devices, and top directories.
./scripts/diskinfo.sh - Check output for any filesystem above 80% usage.
df -h - Drill into high-usage mounts with to find large subdirectories.
du -h --max-depth=1 /mount - Locate specific large files with .
find /path -type f -size +100M
- 运行以获取挂载点、块设备和顶层目录的结构化概览。
./scripts/diskinfo.sh - 查看的输出,检查是否有文件系统使用率超过80%。
df -h - 使用深入分析高使用率挂载点,查找大子目录。
du -h --max-depth=1 /mount - 使用定位特定的大文件。
find /path -type f -size +100M
Commands Reference
命令参考
Filesystem Overview
文件系统概览
- - Disk space usage for all mounted filesystems (human-readable)
df -h - - Inode usage (number of files)
df -i - - Block device tree (disks, partitions)
lsblk - - Currently mounted filesystems
mount
- - 所有已挂载文件系统的磁盘空间使用情况(人类可读格式)
df -h - - Inode使用情况(文件数量)
df -i - - 块设备树(磁盘、分区)
lsblk - - 当前已挂载的文件系统
mount
Directory Size Analysis
目录大小分析
- - Total size of a directory
du -sh /path - - Size of immediate subdirectories
du -h --max-depth=1 /path - - Largest files/directories
du -ah /path | sort -rh | head -20
- - 目录的总大小
du -sh /path - - 直接子目录的大小
du -h --max-depth=1 /path - - 最大的文件/目录
du -ah /path | sort -rh | head -20
Finding Large Files
查找大文件
- - Files larger than 100MB
find /path -type f -size +100M - - Files larger than 1GB
find /path -type f -size +1G - - List files sorted by size (largest first)
ls -lhS /path | head -20
- - 大于100MB的文件
find /path -type f -size +100M - - 大于1GB的文件
find /path -type f -size +1G - - 按大小排序列出文件(从大到小)
ls -lhS /path | head -20
Disk Information
磁盘信息
- - Partition table
cat /proc/partitions - - Mount information
cat /proc/mounts - - Filesystem statistics
stat -f /path
- - 分区表
cat /proc/partitions - - 挂载信息
cat /proc/mounts - - 文件系统统计信息
stat -f /path
Tips
提示
- Always use for human-readable sizes
-h - The command can be slow on large directories; use
duto limit recursion--max-depth=1 - Root filesystem () usage above 90% may cause issues
/
- 始终使用参数以获取人类可读的大小格式
-h - 命令在大型目录上运行可能较慢;使用
du限制递归深度--max-depth=1 - 根文件系统()使用率超过90%可能会导致问题
/