How to create and extract a .tar.gz archive using command line

One of the most common compression formats used in GNU/Linux and variants is tar.gz. A tar.gz file is nothing but a gzipped tar archive. These days users of GNU/Linux system seldom have to use the command line to create or extract tar.gz archives. But it is a useful command to keep in your arsenal if you are a system administrator.

To create a tar.gz archive from a given folder you can use the following command 

tar -zcvf tar-archive-name.tar.gz source-folder-name 

This will compress the contents of source-folder-name to a tar.gz archive named tar-archive-name.tar.gz

To extract a tar.gz compressed archive you can use the following command 

tar -zxvf tar-archive-name.tar.gz 

This will extract the archive to the folder tar-archive-name. 

To extract .tar and .tar.gz files on Windows use PowerArchiver 6.1 (freeware) or 7-zip (freeware) or Winzip (commercial).

Comments

Popular posts from this blog

JMeter – Working with JSON

How to create an XML Log file in Java using JAXB (Customized)

Hyperlocal Startups Creating a Better Living