How to Install and Use kondo in Linux to Clean Build Artifacts and Free Disk Space

Modern software development tools and language package managers frequently generate gigabytes of intermediate build artifacts, compiled object caches, dependencies, and temporary files. Directories like Rust’s target, Node.js’s node_modules, Python’s __pycache__, Gradle’s .gradle, and Go’s build output can quietly consume dozens of gigabytes of solid-state drive space. Searching for and deleting these folders manually with find or custom shell scripts is both tedious and prone to accidental deletion of active project assets. kondo is a command-line tool built specifically to scan software project directories, calculate accumulated artifact weight, and interactively or automatically clean non-essential build files without touching source code.

What Is kondo and Why Use It?

kondo (named after Marie Kondo’s philosophy of tidying) is an open-source, blazing-fast CLI utility written in Rust. It traverses your file tree, recognises project markers—such as Cargo.toml, package.json, build.gradle, pom.xml, CMakeLists.txt, and requirements.txt—and identifies the non-essential build output directories that can be safely deleted and recreated upon next build.

Key advantages of using kondo include:

  • Multi-Ecosystem Detection: Natively identifies Cargo, Node, Python, Maven, Gradle, CMake, Unreal Engine, Unity, SBT, and Swift project artefacts.
  • Interactive Cleaning Mode: Presents a clean terminal user interface prompting you project by project, displaying exact recoverable megabytes before deletion.
  • Zero Source Risk: Never deletes source files, Git repositories, or tracked version control items; only targets known disposable compiler output.
  • Rapid Multithreaded Scanning: Scans massive project directories containing tens of thousands of subfolders in seconds.

Installing kondo on Linux

You can install kondo on Linux via Cargo, pre-built binaries, or distribution package managers.

Method 1: Installing via Cargo

If you have Rust installed on your Linux workstation or server, install kondo directly:

cargo install kondo

Method 2: Downloading Pre-Built Binaries from GitHub

For systems without Rust configured, download the official release binary directly:

KONDO_VERSION=$(curl -s "https://api.github.com/repos/tbillington/kondo/releases/latest" | grep -Po '"tag_name": "\K[^"]*')
curl -Lo kondo.tar.gz "https://github.com/tbillington/kondo/releases/download/${KONDO_VERSION}/kondo-${KONDO_VERSION}-x86_64-unknown-linux-musl.tar.gz"
tar -xzf kondo.tar.gz
sudo mv kondo /usr/local/bin/
rm kondo.tar.gz

Confirm that the binary is installed and operational:

kondo --version

Scanning and Calculating Recoverable Disk Space

Before deleting anything, you can run kondo in analysis mode to inspect how much storage build directories are consuming across your development root:

kondo ~/development

kondo recursively parses the target path and prints a concise table showing:

  • Project path and detected project type (e.g., Cargo, Node, Gradle)
  • Directory containing build artifacts (e.g., /target, /node_modules)
  • Total disk space currently occupied by disposable artifacts
  • Overall total space reclaimable across the entire directory tree

Cleaning Build Artifacts Interactively

To selectively purge disposable directories, launch kondo with the interactive flag:

kondo -i ~/development

In interactive mode, kondo pauses at each discovered project and provides interactive prompts:

  • Press y (or Enter): Deletes the build folder for that specific project and moves to the next.
  • Press n: Skips the project and leaves its build artifacts intact.
  • Press a: Cleans this project and automatically cleans all remaining discovered projects.
  • Press q: Quits the interactive session immediately.

Automated Cleaning and Filtering

For automated cleanup routines or CI/CD maintenance scripts, kondo supports non-interactive execution and project filtering:

Unattended Automatic Cleaning

To purge all detected build directories automatically without manual confirmation:

kondo -f ~/development

Caution: Use the -f (force) flag only when you are confident you want all intermediate build files removed across the specified directory hierarchy.

Filtering by Minimum Artifact Age

Avoid deleting build files from projects you worked on earlier today by enforcing an inactivity threshold:

# Clean only projects whose build artifacts have not been modified in the last 14 days
kondo --older-than 14d -i ~/development

Routine Maintenance Workflow

Adding kondo to your monthly system hygiene checklist keeps development machines lean without disrupting active development workflows. Because modern package managers re-download or rebuild dependencies seamlessly, purging inactive projects frees up tens of gigabytes of valuable disk space in seconds.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.