Operating Systems: Freeing Disk Space

From Soma-notes
Jump to navigation Jump to search

Backup your files!

 rsync -a -v /home/student  <username>@access.scs.carleton.ca:COMP3000/

Become root (so you can delete anything)

 sudo su -

Check how much free space you have in your current directory (human readable):

 df -h .

Find out which files/directories are taking up too much space

 du -x / | sort -nr | head

Delete files

 rm <file>
 rm -rf <directory>   # -f means force, so be sure you specify the right directory!

Clean logs (you may need to reboot to empty out active log files)

 rm /var/log/<large log file>
 journalctl --vacuum-size=1M   # keep only one megabyte of logs