No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
fawn dfc62249d6
All checks were successful
CI / shellcheck (push) Successful in 15s
CI / smoke (push) Successful in 36s
ci: add forgejo workflow
2026-08-30 05:47:45 -04:00
.forgejo/workflows ci: add forgejo workflow 2026-08-30 05:47:45 -04:00
.github/workflows fix unfinished line in workflow 2026-08-29 22:42:46 -04:00
systemd create install shell script & systemd timer and service 2026-08-29 22:36:51 -04:00
.gitignore create .gitignore 2026-08-29 21:47:40 -04:00
dnfsweep scratch together the dnfsweep script 2026-08-29 22:28:37 -04:00
install.sh create install shell script & systemd timer and service 2026-08-29 22:36:51 -04:00
LICENSE.md docs: add README and LICENSE 2026-08-30 05:12:35 -04:00
README.md docs: add README and LICENSE 2026-08-30 05:12:35 -04:00

dnfsweep

shellcheck

dnf clean all doesn't really tell you anything, but it takes everything. dnfsweep shows you what each repo actually costs you on disk, then removes what you ask for.

it reads the dnf5 (/var/cache/libdnf5) and dnf4 (/var/cache/dnf) layouts and the per-user caches at $XDG_CACHE_HOME, and doesn't dare touch a path that isn't in one of these roots.

fawn@fawn:~/Git/dnfsweep$ dnfsweep
/var/cache/libdnf5
  REPOSITORY              PACKAGES   METADATA      TOTAL
  code                           -     507.9K     507.9K
  @commandline                   -          -          -
  fedora                         -      63.7M      63.7M
  fedora-cisco-openh264          -      12.8K      12.8K
  google-chrome                  -      11.5K      11.5K
  updates                        -      37.0M      37.0M
  -------------------------------------------------------
  6 repos                        -     101.2M     101.2M

/home/fawn/.cache/libdnf5
  REPOSITORY              PACKAGES   METADATA      TOTAL
  code                           -     507.9K     507.9K
  fedora                         -      63.7M      63.7M
  fedora-cisco-openh264          -      12.8K      12.8K
  google-chrome                  -      11.5K      11.5K
  updates                        -      37.0M      37.0M
  -------------------------------------------------------
  5 repos                        -     101.2M     101.2M
nothing to reclaim

install

git clone https://github.com/s0uthview/dnfsweep
cd dnfsweep
sudo ./install.sh

this drops the script in /usr/local/bin and offers to install the systemd timer. you can also copy dnfsweep somewhere on your $PATH if you don't want it installed there

usage

the default mode is --packages, which just removes downloaded .rpm files. those are safe to lose since dnf will refetch anything it needs next transaction. --metadata clears repodata and solv caches and will cost you a slower transaction, and --all is both.

nothing is deleted without confirmation, unless passing --yes, and --dry-run will report but not make any changes.

--repo and --exclude take globs and can be repeated. --cache-dir replaces autodetection.

to view the full list of options, run dnfsweep --help