Clearing Disk Space on Ubuntu 22.04

Background

The idea is simple, it is that I do not have enough disk space, since I only allocated around 90GB for my Ubuntu system. And in fact, there are a lot of abundant files that can be removed.

A Useful Command: du -hx --max-depth=1 --threshold=800M, which helps us find directories that takes up over 800MB, and these would be our targets.

Root /

  1. I first find out that there are a number of kernel instances in /usr/lib/modules/, and the fact is that I only need one or two of them. Then I follow the instructions in ref1 and obtain a few more GBs.

  2. Remove Snap (in fact I can find alternatives). Details are in ref2.

  3. Big journels in /var/log/journal!. Details are in ref3

Home ~

  1. I have been using VSCode since first year at college. Although it is great, there are quite a lot issues related to storage.
    • Do you use the cpp-extension in VSCode? If yes, you may need to consider cpptools in ~/.cache/vscode-cpptools. If you want to shorten the space usage of it, please go to settings and edit cache size.

    • Please check ~/.config/Code/User/workspaceStorage, it may also surprise you. See ref4 for more details.

Reference