Update from Sync Service

This commit is contained in:
FNS Service
2026-04-21 20:19:50 +08:00
parent 1c3801d7a6
commit c0a1c4beb4
2 changed files with 151 additions and 42 deletions

View File

@@ -1,5 +1,57 @@
## du -sh /*
## 可以列出你整个VPS所有文件夹的大小。其中“/*”是控制分析哪个目录的,你根据上面的结果,然后灵活变化后面的路径就行了,例如:
## du -sh /usr/*
## 用这个命令来分析usr目录下的文件夹大小最后定位到大文件直接删除就行了。
> 来自 <[https://www.hack520.com/504.html](https://www.hack520.com/504.html)>
# 查看目录大小
## du 命令
```bash
# 查看当前目录总大小
du -sh
# 查看当前目录下各子目录大小
du -h --max-depth=1
# 查看指定目录大小
du -sh /path/to/dir
# 查看目录下各子目录大小
du -sh /path/to/dir/*
# 按大小排序显示(当前目录)
du -sh * | sort -rh
# 查看隐藏目录
du -sh .[!.]* 2>/dev/null
# 查找大于 100M 的文件
find . -type f -size +100M -exec du -h {} \;
```
## df 命令(查看磁盘使用情况)
```bash
# 查看磁盘使用情况
df -h
# 查看 inode 使用情况
df -i
# 查看特定文件系统
df -h /home
```
## ncdu更友好的交互式工具
```bash
# 安装
yum install ncdu # CentOS
apt install ncdu # Ubuntu
# 交互式查看(按大小排序)
ncdu /
# 只显示大于 100MB
ncdu --max-size 100M /
```
---
> 参考:[du 命令详解](https://www.hack520.com/504.html)