Operating Systems: Freeing Disk Space

From Soma-notes
Revision as of 23:05, 19 March 2020 by Soma (talk | contribs) (Created page with "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 yo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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