Extracting Compressed File tar.gz Format in Linux

Posted on

Operating System            : Mainly All Linux Distributions

Extracting Compressed File with the format of *.tar.gz using tar Command

To extract compressed file with file format of *.tar.gz, we will need several parameter used with a command ‘tar’.  Based on the man page of tar command, it is specified that tar is the GNU version of the tar archiving utility.

Not only it can be used to make archive file but it can also be used to extract the already archived file to extract their original file content.

In this context, we are going to extract archived file or compressed file with the format of *.tar.gz. It is quite easy to do it by executing the following steps :

  1. Open your terminal or CLI (Command Line Interface) available in your operating system.
  2. Depends on the permission of the files whether you have the permission to execute the file by extracting or not, you should be able to extract it if you have the permission by typing the following command :
username@hostname:~$ tar –xzvf compressed_file_format_name.tar.gz

The above command has several parameter on it which can be explained in detail :

-x            : it it the short version of --extract and as the long version shows it is a parameter used by the command to extract files from archive file
-z            : it is the short version of --gzip,--gunzip, --ungzip, which is used to extract the archive file with .gz format
-v            : it is the short version of --verbose, which is a certain parameter used to display all of the output available which is produced by executing the command directly to your monitor or display
-f             : it is the short version of --file and it is a parameter used to specify or use the archive file or device ARCHIVE specified after the -f or --file parameter. In the above context that file name is compressed_file_format_name.tar.gz
  1. If nothing goes wrong you should be able to execute the command and ended up having the file extracted and found yourself to be able to see all the original content of the archived file.

Try to execute some of your compressed file archive using your PCs or laptops certainly if you have compatible operating system and also the ‘tar’ utility installed as part of binary program available in your operating system.

Leave a Reply