From c862c171330389c2f2f7597f2d73e6853a3e2dfb Mon Sep 17 00:00:00 2001 From: Martin <1403951401@qq.com> Date: Thu, 6 Feb 2025 09:37:50 +0800 Subject: [PATCH] =?UTF-8?q?[+]=20=E5=A2=9E=E5=8A=A0=E6=B8=85=E7=90=86?= =?UTF-8?q?=E7=A3=81=E7=9B=98=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ clean.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 clean.sh diff --git a/README.md b/README.md index e12a046..0064cf8 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,8 @@ docker compose run ubuntu ./init-all.sh ```bash docker compose run ubuntu-2204 ./init-all.sh ``` + +### 清理磁盘 +```bash +curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/clean.sh | bash +``` \ No newline at end of file diff --git a/clean.sh b/clean.sh new file mode 100644 index 0000000..26ed835 --- /dev/null +++ b/clean.sh @@ -0,0 +1,17 @@ +# 清理 apt +sudo apt-get autoremove -y +sudo apt-get autoclean -y +sudo apt-get clean -y +# 清理 docker +docker system prune -a -f --volumes +# 清理日志 +sudo journalctl --vacuum-size=10M +# 列出清理后容器大小 +docker ps -a --format "{{.ID}}\t{{.Image}}\t{{.Size}}" +docker images --format "{{.Repository}}:{{.Tag}}\t{{.Size}}" +# 列出磁盘空间 +df -h + +# 查看占用磁盘 +# sudo du -ah / | sort -rh | head -20 +