tar gzip example - how to extract a tar archive that has been gzip'd

tar gzip FAQ: Can you show how to extract (un-tar) a tar archive that has been created with tar and gzip?

Say you have a file (archive) named myfile.tar.gz, and you want to unzip it and unpack (un-tar) it in one command. This "tar extract" command should do the trick for you:

tar xzf myfile.tar.gz

That tar command can be read as "use tar and gzip (the 'z' option) to extract the contents of the file (archive) named myfile.tar.gz.

That tar command works pretty quietly, but if you'd like it to work in verbose mode, just add the 'v' option to the tar command, like this:

tar xzf myfile.tar.gz

The tar verbose option prints out every filename as the tar archive is being extracted.

Finally, if that doesn't work for some reason, you can perform the gunzip and tar extract commands in two different steps, like this:

gunzip < mysql-ruby-2.4.4a.tar.gz | tar xf -

(However, I haven't had any reason to use that syntax in a long time myself.)

More tar command information

For much more information on the tar command, see my Unix/Linux tar commands examples page.