Get the Best Compression Possible with gzip-[0-9]Just as with zip, it's possible to adjust the level of compression that gzip uses when it does its job. The gzip command uses a scale from 0 to 9, in which 0 means "no compression at all" (which is like tar, as you'll see later), 1 means "do the job quickly, but don't bother compressing very much," and 9 means "compress the heck out of the files, and I don't mind waiting a bit longer to get the job done." The default is 6, but modern computers are fast enough that it's probably just fine to use 9 all the time. $ ls -l -rw-r--r-- scott scott 1236574 moby-dick.txt $ gzip -c -1 moby-dick.txt > moby-dick.txt.gz $ ls -l -rw-r--r-- scott scott 1236574 moby-dick.txt -rw-r--r-- scott scott 571005 moby-dick.txt.gz $ gzip -c -9 moby-dick.txt > moby-dick.txt.gz $ ls -l -rw-r--r-- scott scott 1236574 moby-dick.txt -rw-r--r-- scott scott 487585 moby-dick.txt.gz Remember to use the -c option and pipe the output into the actual .gz file due to the way gzip works, as discussed in "Archive and Compress Files Using gzip." Note If you want to be clever, define an alias in your .bashrc file that looks like this: alias gzip= ' gzip -9 ' That way, you'll always use -9 and won't have to think about it. |