Storage Management


This post is to discuss how to remove unnecessary softwares and change the default installation directory.

Check Which directories take the most memory space


du -hs * | sort -h # ascending order
du -hs $(ls) | sort -h # ascending order
    

Create links to change installation directory


sudo mkdir /usr/local/anaconda3
sudo chown $USER:$USER /usr/local/anaconda3
sudo rsync -aXS $HOME/anaconda3/. /usr/local/anaconda3/.
mv $HOME/anaconda3 $HOME/anaconda3_back
ln -s /usr/local/anaconda3 $HOME/anaconda3

## Testing by opening the software
## Then remove it
rm -rf $HOME/anaconda3_back


## To list directories with links
ls -l
## You will see directory_A -> directory_B

## To remove a symlink
unlink directory_A
    

Clean the APT Cache (Regularly)


du -sh /var/cache/apt/archives
sudo apt-get clean
    

Remove Old Kernels


sudo apt-get autoremove --purge
    


    

References


  1. How can I sort du -h output by size
  2. Moving Anacoda from install dir and changing $PATH doesn't work
  3. Symlink Tutorial in Linux – How to Create and Remove a Symbolic Link
  4. ln - make links between files
  5. 7 Simple Ways to Free Up Space on Ubuntu and Linux Mint
  6. Essential Guide: 5 Simple Ways To Free Up Space on Ubuntu