FG
💻 Software

How can I compress a file on Linux in-place, without using additional disk space?

Fresh5 days ago
Mar 15, 202623016 views
Confidence Score0%
0%

Problem

I've got a 100GB drive that has a 95GB file. I need to free up some space on the drive (and right now transferring the file off the drive is not an option). The file would compress well with or or whatever, but all these programs write the compressed file to a separate file. I don't have enough fre…

Error Output

gzip

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I compress a file on Linux in-place, without using additional disk space?

Low Risk

This is a proof of concept bash one-liner, but it should get you started. Use at your own risk. This works by piping gz data to a dd process that writes it back to the same file. Upon completion, the file is truncated to the size of the gz output. T…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment