How to extract tar.gz files

Last Updated on September 27, 2015 by admin

The command to extract tar.gz files is:

tar xzf myarchive.tar.gz

The tar command options explained

  • [x] The x stand for extract, it is mandatory when a tar file shall be extracted.
  • [z] The z option tells tar that the archive that shall be unpacked is in gzip format.
  • [f] This option instructs tar to read the archive content from a file, in this case the file myarchive.tar.gz.

The above tar command will silently extract that tar.gz file, it will show only error messages. If you like to see which files get extracted, then add the "v" option.

tar xzvf myarchive.tar.gz

The [v] option stands for verbose, it will show the file names while they get unpacked.

Extract tar with tar xzf

Leave a Comment