• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

All Linux Compress/Decompress Commands

by admin

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.

Filed Under: Linux

Some more articles you might also be interested in …

  1. “az storage queue” Command Examples
  2. drush: A command-line shell and scripting interface for Drupal
  3. ganache-cli: Command-line version of Ganache, your personal blockchain for Ethereum development
  4. How to configure iSCSI Initiator (client) in CentOS / RHEL 7
  5. aws-vault Command Examples (A vault for securely storing and accessing AWS credentials in development environments)
  6. qm start Command Examples in Linux
  7. git commit-graph: Write and verify Git commit-graph files
  8. restorecon: command not found
  9. browser-sync: Starts local web server that updates browser on file changes
  10. dnstracer: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright