How to clean up a full root directory in Ubuntu?
- To check which files or directories are taking up the most space, you can use the command “du -h –max-depth=1 / | sort -hr” to list the size of each file or directory under the root directory and sort them by size.
- To clean up unnecessary log files and temporary files, you can use the commands sudo rm -rf /var/log/* and sudo rm -rf /tmp/* to clear them out.
- To clean the apt cache and free up disk space, you can use the command sudo apt-get clean.
- To clean up old kernels, you can use the command sudo apt-get autoremove to remove them and free up disk space.
- Uninstall unnecessary packages by using the command sudo apt-get remove
. - If the root directory is still taking up a lot of space, you may need to consider resizing the root directory or reorganizing the partitions.
Please remember to back up important data during the cleaning process to prevent accidental deletion and data loss.