All Linux Compress/Decompress Commands

Linux contains several file compression/decompression utilities. Although this may sound great, it often leads to confusion and chaos when trying to download files. Below examples lists the compression/decompression utilities available in Linux along with an example.

1. zip – To compress a file:

# zip file.txt 

2. gzip – To compress or expand files:

# gzip file.txt 

3. bzip2 – To compress or expand files using block sorting:

# bzip2 file.txt 

4. bzcat – Decompress files to output device:

# bzcat file.gz 

5. bzcmp – To compare bzip2 compressed files:

# bzcmp file1.bz2 file2.bz2 

6. bzdiff – To compare bzip2 compressed files:

# bzdiff file1.bz2 file2.bz2 

7. bzgrep – To search bzip2 compressed files:

# bzgrep "search text" file1.bz2 

8. bzip2recover – To recover data from damaged bzip2 file:

# bzip2recover  

9. bzless – To view bzip2 compressed file:

# bzless file.bz2 

10. bzmore – To view bzip2 compressed file:

# bzmore file.bz2 

11. znew – To recompress .Z files to .gz files:

# znew file.Z 

12. zcmp – compare compressed files:

# zcmp file1.Z file2.Z 

13. zmore – To view compressed file:

# zmore file.Z 

14. zforce – To force a *.gz extension on all gzip files:

# zforce file 

15. gzexe – To compress executable files:

# gzexec file.sh 

16. zip – To package and compress (archive) files:

# zip file.txt 

17. unzip – To list, test and extract zip compressed files:

# unzip file.txt 

18. compress – To compress data:

# compress file.txt 

19. uncompress – To expand compressed data:

# unzompress file.Z 

20. zcat – To compress or expand files:

# zcat file.gz 

Final Thought

A few file compression utilities are available in Linux, including gzip and zip. Each one allows you to compress large files to help save space on your filesystem. This post listed out the compression and decompression utilities available in Linux and provided with an example of each.

Related Post