LinuxCommandLibrary

eclean

Clean Gentoo's Portage package cache

TLDR

Clean the source file directory

$ sudo eclean distfiles
copy

Clean the binary package directory
$ sudo eclean packages
copy

Clean the distfiles of all uninstalled packages, but keep the distfiles of installed packages
$ sudo eclean [[-d|--deep]] [[-n|--package-names]] distfiles
copy

Clean the binary packages of all uninstalled packages, but keep the binaries of installed packages
$ sudo eclean [[-d|--deep]] [[-n|--package-names]] packages
copy

SYNOPSIS

eclean [options] distfiles|packages [package atoms]

PARAMETERS

-a, --ask
    Ask before performing any cleaning actions

-C DIR, --cache-dir=DIR
    Use cache directory DIR instead of default

-d DAYS, --days=DAYS
    Keep files newer than DAYS days old (default: 5)

-f FILE, --fetch=FILE
    Fetch FILE instead of using cached metadata

-h, --help
    Show help message

-l DIR, --log-dir=DIR
    Use log directory DIR instead of default (/var/log/portage)

-m NUM, --max-files=NUM
    Keep at most NUM files per package (default: 1)

-n, --dry-run
    Dry run: show what would be done without deleting

-p, --pretend
    Pretend mode (same as --dry-run)

-q, --quiet
    Suppress non-essential output

-s SIZE, --size=SIZE
    Keep files until total SIZE bytes are used (default: 500M)

-V, --version
    Show version information

-v, --verbose
    Increase verbosity

DESCRIPTION

eclean is a utility from Gentoo's gentoolkit package designed to reclaim disk space by removing unnecessary files from Portage caches. It primarily targets two objects: distfiles in /var/cache/distfiles (source tarballs and patches) and packages in /var/cache/binpkgs (pre-built binary packages).

By default, eclean distfiles deletes files older than 5 days or exceeding size limits that are not referenced by the Portage tree or installed packages. Similarly, eclean packages removes outdated binary packages. Users can specify package atoms like category/package to clean selectively.

This tool fetches the latest metadata from the Portage tree to determine safe deletions, ensuring essential files for current dependencies remain intact. It's particularly useful on systems with limited disk space, as Gentoo's source-based builds generate large caches over time. Run regularly via cron for maintenance.

Options allow customization, such as dry-runs for previewing actions, verbose output, or keeping more files per package. Always use caution, as aggressive cleaning might require re-fetching files during future emerge operations.

CAVEATS

May require re-fetching distfiles if needed later; use --dry-run first. Not for non-Gentoo systems.

EXAMPLES

eclean distfiles -- cleans unused distfiles
eclean packages sys-apps/portage -- clean specific package binaries
eclean -n -v distfiles -- verbose dry-run

DEFAULT PATHS

Distfiles: /var/cache/distfiles
Packages: /var/cache/binpkgs
Adjust with PORTAGE_DISTDIR and PKGDIR variables.

HISTORY

Developed as part of Gentoo's gentoolkit (app-portage/gentoolkit), first released around 2004. Evolved to handle binary packages with Portage updates; current versions support modern metadata fetching.

SEE ALSO

emerge(1), eix(1), genlop(1), qlist(1)

Copied to clipboard