hungrycat

hungrycat is a tool that prints contents of a file on the standard output, while simultaneously freeing disk space occupied by the file. It can be useful if you need to process a large file, but you don't have enough space to store the output file and you wouldn't need the input file afterwards.

Author: Jakub Wilk

License: The Expat license

Version: 0.4.2 released on 2024-01-22

Example:
$ md5sum bigfile
d9b18676a36c919c1688cba61a2cf0f1  bigfile

$ ls -lh bigfile
-rw-r--r-- 1 jwilk users 281M Sep 13 19:46 bigfile

$ df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/ice9             330M  284M   29M  91% /mnt/ice9

$ hungrycat bigfile | xz > bigfile.xz

$ ls -lh bigfile*
-rw-r--r-- 1 jwilk users 60M Sep 13 19:49 bigfile.xz

$ df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/ice9             330M   63M  251M  20% /mnt/ice9

$ xz -d < bigfile.xz | md5sum
d9b18676a36c919c1688cba61a2cf0f1  -