How to use compress files on Linux

In Linux (As well as Unix), there are archiving and compressing tools available for users to use.

compress/uncompress

The most common tool available is compress and uncompress on Linux.

The compress tool will compress files to as small as it can be on the account.

To use the command, type the following:

compress <file>

You can also compress multiple files.

For example, you want to compress all .txt files in a location, you do the following:

compress *.txt

Or you want to compress all the files in a location:

compress *

This will then put a '.Z' at the end of the file, and the file should be shrunk down as much as it is possible.

Obviously, a compressed file will no longer be readable, so to make it readable again, you will need to uncompress the file.

This is done with the uncompress tool.

Similar to compress, you can use the same method as above on compressed files.

Note

The compress and uncompress tools are mostly Linux only.

gzip

Another compression tool that is available is gzip.

Similar to compress, gzip is used on several other systems, and you can get the application for Windows and Mac to expand out the file.

gzip is used the same way as compress, the only exception is for uncompressing a gzip file, you will need to type the following:

gzip -d <file>.gz

gzip files will always end with .gz.