Unzip (decompress) and extract files from a .tar.gz file
Run:
$ tar -xvzf file.tar.gz
First a reminder:
why do we end up with a
.tar.gzfile?
tar collects multiple files to create one single file. Then, we use gzip to compress that single .tar file into a .gz file, thus the compound .tar.gz extension.
So to reverse the process, we first need to decompress file.tar.gz using gzip, and then extract the files from the remaining file.tar.
What do the options we pass mean?
ztells tar to decompress the file using gzipxextracts all files from the.tarfile.ftells tar the path and name of the file to decompress and extract; this must be the last flag of the command, and the.tar.gzfile must come right after.vmakes tar list all the files being extracted in the terminal as the command runs
To extract into a specific folder, pass the -C option to the command followed by the name of the folder where you want tar to extract the files:
$ tar -xvzf file.tar.gz -C folder
personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki tar