df -h
查看磁盘分区使用情况。du -sh /path/*
查看指定目录占用空间,定位大文件或目录。cargo clean
,删除当前项目 target
目录及缓存。~/.cargo/registry
和 ~/.cargo/git
目录(谨慎操作,可能影响依赖)。rm -rf /path/to/project/target
。find /projects/path -type d -name target -exec rm -rf {} +
。CARGO_TARGET_DIR
环境变量统一管理 target
目录,或使用 cargo-sweep
工具清理旧产物。rustup
卸载不需要的工具链:rustup self uninstall
或 rustup update
时选择保留最新版本。sudo yum clean all
。rm -rf /tmp/*
(避免删除重要文件)。truncate
或 logrotate
压缩/删除旧日志,例如:sudo truncate -s 0 /var/log/*.log
。rpm -q kernel
,删除旧版本:sudo yum remove kernel-<版本号>
。sudo btrfs property set /path compression zstd
)。target
目录和YUM缓存。cron
定时任务预警。注意:操作前建议备份重要数据,尤其是删除系统或项目文件时需谨慎确认。