Skip to content

How to Cleanup Manjaro

Summary

This article is largely a copy/paste from a Gist I found on GitHub regarding how to clean-up any Arch Linux based system. For my needs, I use it to clean-up Manjaro.

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • Remove old config files
  • Find and Remove
    • Duplicates
    • Empty files
    • Empty directories
    • Broken symlinks
  • Find Large files

Clean pkg cache

List packages

ls /var/cache/pacman/pkg/ | less 

Remove all packages except those installed

sudo pacman -Sc 

Remove all files

sudo pacman -Scc

Download manually from archive.

Automatically remove

sudo pacman -S pacman-contrib

Remove

paccache -r

Systemd timer

Create file in /etc/systemd/system/paccache.timer with the following contents:

[Unit]
Description=Clean-up old pacman pkg cache

[Timer]
OnCalendar=monthly
Persistent=true

[Install]
WantedBy=multi-user.target

Enable with sudo systemctl start paccache.timer

Pacman post-transaction hook

Remove unused packages

List unused

sudo pacman -Qtdq

Remove unused

sudo pacman -R $(pacman -Qtdq)

Clean home cache

Cache is located in ~/.cache

Config Files

Stored in ~/.config/

Find and remove

Install rmlint package with sudo pacman -S rm lint.

References

https://gist.github.com/rumansaleem/083187292632f5a7cbb4beee82fa5031 https://gist.github.com/davelevine/26c5d2c47df3b802b75673dd5388ea28