Beginner's Guide: Linux Disk Space Cleaning Tips
When the disk space on a Linux server is insufficient, you can resolve it by following these steps: First, execute `df -h` to check partition usage, focusing on the root directory or system directories like `/var`. Next, use `du -sh` to locate large directories (e.g., `/var/cache`), and `find / -type f -size +100M 2>/dev/null` to search for large files. For targeted cleanup: Logs in `/var/log` can be rotated using logrotate or old compressed packages deleted; temporary cache files in `/tmp` and `/var/tmp` can be cleared after running `sync`, or system cache can be released by `echo 3 > /proc/sys/vm/drop_caches`; uninstall unnecessary software packages (via `yum` or `apt`); and large files in user directories (e.g., under `/home`) can be directly deleted. **Note**: Do not delete system-critical files. Confirm no programs are using files before deletion, and follow the procedures for safe and efficient operation.
Read More