Czkawka is a fast and efficient tool for finding duplicate files, empty directories, temporary files, and more. The command line version (Czkawka CLI) is a lightweight tool and perfect for server environments or scripting tasks. This tutorial explains how to install Czkawka CLI on Ubuntu 24.04.
Install Czkawka CLI
First, download the latest precompiled binary and place it in the system path:
sudo wget -qO /usr/local/bin/czkawka_cli https://github.com/qarmin/czkawka/releases/latest/download/linux_czkawka_cli_x86_64
Next, give the binary execute permission:
sudo chmod a+x /usr/local/bin/czkawka_cli
Verify that the installation was successful by checking the version:
czkawka_cli --version
Testing Czkawka CLI
To see Czkawka in action, let's build a test directory, download the image and duplicate it:
mkdir test_dir
wget -qO test_dir/test1.png https://raw.githubusercontent.com/opencv/opencv/master/samples/data/sudoku.png
cp test_dir/test1.png test_dir/test2.png
cp test_dir/test1.png test_dir/test3.png
Now, scan the directory for duplicate files and save the results to a text file:
czkawka_cli dup -d test_dir -f results.txt
View the report with:
cat results.txt
Sample output:
Results of searching ["/home/ubuntu/test_dir"] (reference directories []) with excluded directories [] and excluded items []
-------------------------------------------------Files with same hashes-------------------------------------------------
Found 2 duplicated files which in 1 groups which takes 489.69 KiB.
---- Size 244.84 KiB (250720) - 3 files
"/home/ubuntu/test_dir/test1.png"
"/home/ubuntu/test_dir/test2.png"
"/home/ubuntu/test_dir/test3.png"
This confirms that all three PNG images are identical copies.
To automatically delete duplicates while keeping one copy, run:
czkawka_cli dup -d test_dir -D AEO
This command will clean up redundant files and leave only a single instance of each duplicate set. Here the -D AEO
option controls the deletion behavior. It will keep the oldest file and remove the newer duplicates.
Uninstall Czkawka CLI
If you no longer need the Czkawka CLI, simply remove the binary:
sudo rm -rf /usr/local/bin/czkawka_cli
Leave a Comment
Cancel reply