How to Compress and Decompress Files on Linux

0
495

Linux is really powerful platform loaded with strong compressing and decompressing mechanisms built-in. For Linux users, you may already have learned the name of .ZIP, .GZ, .TAR.GZ, .TGZ, .BZ2 etc. file types, right? These are different file compression methods and file types that Linux support by default. You can compress and decompress files into the formats on all the Linux distros.

Now, let’s take a look how to compress files into the following format.

Compressing files

  • ZIP

Zip is definitely one of the most popular compressed file formats. It’s widely used in all the platforms and really powerful for basic usage.

For compressing, ZIP uses the following structure:

If you want to compress a directory using ZIP, run this command:

In this example, I’m going to compress my Thunderbird profile. It’s also an awesome trick for backing up your Thunderbird profile.

For decompressing the ZIP file, run this command:

  • TAR

It’s a really powerful tool for compressing and decompressing the file(s) and directory. It’s more widely used as it offers more support for advanced compressing formats like TAR.BZ2. For compressing a file or directory using TAR command, follow the following structure:

For example, I’ll be compressing my “~/.thunderbird” directory. If you want to compress the file(s), just exchange the later part of the command.

For decompressing the file, run this command:

There’s also another file type called XZ. This one follows extreme compression method and used for compressing lots of small files into one, tight archive.

For turning into XZ archive, use the following command structure:

  • GZIP & BZIP2

These tools also come pre-installed in most of the Linux distros. They’re not used as frequently as they lack the ability to compress directory. These are generally there for serving as the algorithm source for other software like TAR. However, you can still use them in the same way. The command line structure is quite same.

For decompressing a compressed file, use the following commands:

Voila! Enjoy the powerful compression feature of Linux!

Spread the love
  • 13
    Shares

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here