Extract tar.gz file in Linux

tar.gz is a format of a gzip compressed tar archived file. It is a common format in distributing files in *nix.

To extract a tar.gz file, the most basic syntax is as the following;

and to extract tar.bz2 you can use this command:

The command will extract the file to the current working directory. Current versions of the tar program doesn’t require the -z switch, as it auto detects the file format and extract accordingly.

To extract in verbose mode, and to a directory called /target, the following is the syntax;