What are GZIP, GUNZIP, ZCAT & TAR Commands on Linux

In this tutorial we explain what they are and how to use the GZIP, GUNZIP and ZCAT commands in Linux to compress and decompress files.


This command is responsible for reducing the size of data using LZ77 (Lempel-Ziv) encoding. GZIP converts the files with the following extensions, without losing their quality or their properties.

GZIP is an abbreviation of GNU ZIP which is the replacement of the compress program. When a file name is too long, GZIP is responsible for truncating it for proper administration. By default, GZIP retains the original name of the file and all its properties without affecting any, which facilitates its management and correct execution. When we have compressed a file with GZIP we can unzip it using one of the following options:

In case the new name of the data to be decompressed is not in the current file system's guidelines, a new one will be created. GUNZIP replaces each file that we compress whose ending is .gz, -gz, .z, -z, or _z and in the same way recognizes the extensions .tgz and .taz. With this command we can unzip files that have been created by any of the following tools:

gzip, zip, compress, compress -H or pack.

GZIP automatically detects these extensions and executes their process. We can extract multiple Zip files using unzip.

gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]


Its use is identical to gunzip -c, and its primary function is to decompress a list of files through the command line.

ZCAT will decompress the file if it has the magic number regardless of whether or not it is .gz. Additional with ZCAT we can see the contents of a compressed file without the need to unzip it as if we were using the cat command.


zcat [ -fhLV ] [ name ... ]


With GUNZIP we can compress files using Lempel-Ziv technology and allows individual archives to present a reduction of up to 60% in size which helps at the level of space in the equipment. GUNZIP keeps all the properties of the file to be compressed or decompressed.

gunzip [ -acfhlLnNrtvV ] [-S sufijo] [ nombre... ]

4. TAR

One of the commands to decompress or compress files through the terminal in Linux is the tar command if you want information about this type in a terminal man tar and you will see all your options. You can compress a complete directory or a simple file; you can also work recursively (for example compressing everything that is within a directory that you specify).

Compress files using tar

We have to execute the following instruction:

tar -czvf file.tar.gz file_name_to_compress

Meaning of the parameters

  • -c: Create a file
  • -z: Compress the file with gzip.
  • -v: To activate the “verbose” mode. It's optional, but it can help you.
  • -f: Allows you to specify the name of the file.

Unzip files using tar

We must execute the following instruction:

tar -xzvf CompressedFile.tar.gz

The parameters are the same, except that -c has been changed to – x, this serves to indicate that we want to extract the content.

Each of these commands offers us practical options for the many management of files in Linux.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *