Reclaim disk space

Clear the cache

Flatpak cache

If Flatpak applications are installed on the system, Flatpak cache files may accumulate and consume unnecessary disk space. To remove Flatpak cache files:

  1. Close any Flatpak applications currently running on the system.

  2. Launch a terminal window

  3. Run the following command:

    $ echo sudo rm -rf /var/tmp/flatpak-cache-*
    
  4. Check the output of the command and verify that it is absolutely identical to what is written in the previous step of this guide.

  5. If it is identical:
    1. Press the “up” directional arrow key on the keyboard to show the previous command.

    2. Delete the text echo from the command.

    3. Press Enter to run the command.

The Flatpak cache is now cleared.


User cache

An easy way to reclaim a substantial amount of disk space is to clear the cache in a user’s home directory.

  1. Launch a terminal window

  2. Run the following command:

    $ rm -rf ~/.cache/*
    

The user cache is now cleared.




Limit the maximum capacity of the system journal

If left at default values and not checked for a long time, the system journal logs can eventually consume multiple Gigabytes of data. To set the maximum allowable size of the system journal logs 1:

  1. Launch a terminal window

  2. As root (or using sudo), modify the /etc/systemd/journald.conf file

    1. Locate the following line:

      #SystemMaxUse=
      
    2. Uncomment the line by removing the preceding # character

    3. Set a max threshold in MB (M), GB (G), etc. For example, a 512 MB max capacity is represented as:

      SystemMaxUse=512M
      
    4. Save the file

  3. Restart the journald service:

    $ sudo systemctl restart systemd-journald.service
    

The journal service will now never exceed the size of the configured capacity.

1

Source




Remove unneeded files

Flatpak

If Flatpak applications are installed on the system, outdated software dependencies may potentially accumulate and consume unnecessary disk space. To remove dependencies no longer needed by Flatpak applications that are installed on the system:

  1. Launch a terminal window

  2. Run the following command:

    $ flatpak uninstall --unused