How to Install and Use Czkawka CLI in Linux to Find and Remove Duplicate Files

Over months of daily computing, software development, and media downloading, Linux storage drives inevitably accumulate unwanted duplicate files, orphaned temporary downloads, zero-byte empty folders, and broken symbolic links. While traditional command-line scripts using find, md5sum, and awk can identify identical files, scanning massive multi-terabyte drives or large photo archives with legacy shell loops can take hours and place heavy, sustained loads on your hardware.

To deliver blazing-fast storage cleanup, Czkawka (a Polish word meaning hiccup) provides a memory-safe, multi-threaded duplicate cleaner written in Rust. Capable of evaluating file sizes, cryptographic hashes, and visual similarity using multi-core processor parallelisation, Czkawka offers a powerful command-line interface (czkawka_cli) tailored for servers, remote SSH sessions, and desktop power users. This guide explains how to install Czkawka CLI on Linux, scan directories for duplicate files, identify empty folders and broken symlinks, and safely prune unnecessary files.

What Is Czkawka CLI and Why Is It So Fast?

Unlike older duplicate finders such as fdupes or simple hash scripts, Czkawka employs advanced multi-stage filtering algorithms to minimise disk input/output (I/O) bottlenecks:

  • Size-First Filtering: Czkawka groups files by exact byte size first. Files with unique file sizes are immediately discarded before performing expensive cryptographic read operations.
  • Partial Hashing Strategy: Before hashing an entire 10 GB file, Czkawka computes a cryptographic hash of the first 2 KB header. Only if two files share identical headers does the utility proceed to full content verification.
  • Multi-Threaded Concurrency: Written in Rust with Rayon concurrency, Czkawka automatically saturates all available CPU cores during disk traversal.
  • Comprehensive Cleanup Modes: Beyond exact byte duplicates, Czkawka detects empty directories, zero-byte files, temporary files, invalid symlinks, and duplicate music files with mismatched ID3 tags.

How to Install Czkawka CLI on Linux

Czkawka CLI is distributed as a standalone, statically linked executable that requires no external runtimes or library dependencies.

Method 1: Installing the Pre-Compiled Static Binary

  1. Download the latest pre-compiled CLI binary from the official GitHub release page using curl:
    curl -sL https://github.com/qarmin/czkawka/releases/latest/download/linux_czkawka_cli -o czkawka_cli
  2. Grant execution permissions to the downloaded binary:
    chmod +x czkawka_cli
  3. Move the executable to your system binary directory:
    sudo mv czkawka_cli /usr/local/bin/
  4. Confirm the installation:
    czkawka_cli --version

Method 2: Installing via Cargo

If you maintain a Rust environment on your Linux workstation, compile Czkawka directly from source:

cargo install czkawka_cli

Scanning for Duplicate Files with Czkawka CLI

The core command for locating exact duplicates is the dup sub-command:

czkawka_cli dup -d <DIRECTORY_PATH>

Step 1: Running a Basic Scan

To scan your personal documents directory for duplicate items, execute:

czkawka_cli dup -d ~/Documents

Czkawka will rapidly inspect the folder hierarchy and output grouped blocks of matching files, indicating their exact size, hash matches, and full paths.

Step 2: Exporting Results to a Text File

When scanning large filesystems containing thousands of duplicates, review the findings in an external text file before taking action:

czkawka_cli dup -d /data/storage -f ~/duplicates_report.txt

Filtering by Size and Excluding Directories

To prevent scanning irrelevant system files or tiny cache files, use Czkawka’s granular filtering parameters:

Setting Minimum File Size

If you only want to locate substantial duplicate files (such as videos or ISO images larger than 50 MB) to recover disk space quickly:

czkawka_cli dup -d ~/Downloads --minimal-file-size 50M

Excluding Directories and Hidden Files

To instruct Czkawka to skip version control directories or cache folders, use the -e (exclude) flag:

czkawka_cli dup -d ~/Projects -e ~/Projects/.git,~/Projects/node_modules

Finding Empty Folders, Zero-Byte Files, and Broken Symlinks

Czkawka includes dedicated operational sub-commands for various filesystem cleanup tasks:

Finding and Cleaning Empty Directories

To locate empty folder trees left behind by uninstalled software or deleted downloads:

czkawka_cli empty-folders -d ~/Downloads

Finding Zero-Byte Empty Files

To uncover empty zero-byte stub files across your filesystem:

czkawka_cli empty-files -d ~/Documents

Finding Broken Symlinks

To detect symbolic links pointing to non-existent target files:

czkawka_cli symlinks -d /usr/local

Safely Deleting Duplicate Files

By default, Czkawka operates in read-only inspection mode. Once you have validated the output, you can automate file pruning using the --delete-method flag.

Automating Cleanup with Retention Rules

Czkawka allows you to specify which copy of each duplicate group to retain:

czkawka_cli dup -d ~/Downloads --delete-method AEN
  • AEN (All Except Newest): Deletes all duplicate copies while keeping the newest file.
  • AEO (All Except Oldest): Deletes all duplicate copies while keeping the oldest original file.
  • HARD: Replaces duplicate files with hard links, instantly reclaiming physical disk blocks without altering directory structures.

Safety Best Practices Before Deleting Files

Always exercise caution when pruning files across automated systems:

  • Always Run Dry Scans First: Never execute deletion flags on an unfamiliar folder tree without first reviewing the plain text report.
  • Avoid Scanning System Directories: Never run deletion commands against /etc, /usr, or /var, where identical files across package libraries are expected and necessary.
  • Maintain Backups: Verify that critical family photos or source code repositories are backed up off-site before executing bulk batch deletions.

Get the best tech tips delivered straight to your inbox.

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