Similarly, you can unzip specific directories from the archive as well. To do so, simply pass the file names with the default command. You can choose which files to extract from the archive. where z, t, v, and f stand for gzip, List, Verbose, and Filename. To view the content of an archive prior to extracting it: tar -ztvf When you compress a TAR file using bzip2, the output file will have either of the following extensions: TAR.BZ2, TAR.BZ, or simply TBZ.
![tar gz unzip tar gz unzip](https://www.easytechguides.com/images/unzip-compressed-files-using-winrar-20-3-2017.png)
Bzip2: Similar to gzip, several other file compression algorithms are also available, including bzip2.The TGZ file extension is also used sometimes instead of TAR.GZ. TAR is the file extension for tarballs, whereas GZ denotes gzip. TAR.GZ: A TAR.GZ file is a version of a tarball compressed with the gzip algorithm.The file extension for gzip is GZ and therefore, you can deduce that any file ending with GZ has been compressed using the gzip algorithm. Gzip: GNU gzip is a file compression algorithm used to compress files.This is because the TAR filetype was originally created to store data in magnetic tapes. A tarball is often simply called a TAR file, which stands for Tape Archive. The term tarball comes from the coal-based sealant used during construction works. Tarball: A tarball is a collection of multiple files in Linux stored as a single file.You can also extract some sub-directory: $ tar -xvf foo. $ tar -xjvf 2 docs/bar.txt Extract a Single Directory from a TarballĮxtract a folder, called docs, from an archive: $ tar -xvf foo.tar docs You can also specify a path to the file: $ tar -xvf foo.tar docs/bar.txt List the contents of a tar.bz2 file: $ tar -jtvf tar.bz2 OptionĬool Tip: There is no more need to remember all these -xvf, -xvzf, -xvif keys! This awesome bash function permits to extract any archive type with the single extract command! Read more → Extract a Single File from a TarballĮxtract a file bar.txt, from an archive: $ tar -xvf foo.tar bar.txt List the contents of a tar.gz file: $ tar -ztvf List the contents of a tar file: $ tar -tvf foo.tar
![tar gz unzip tar gz unzip](https://i.ytimg.com/vi/d1bYp6q5bsc/maxresdefault.jpg)
Sometimes it is needed just to check the contents of a tarball without unpacking it.įor example, it goes without saying, that it is inadvisable to untar the whole large archive if you need for example to extract only a dingle file or a directory from it.Īnd of course this is possible with the Linux tar command, but firstly you need to check what is there inside the tarball without unpacking it.
![tar gz unzip tar gz unzip](https://i.ytimg.com/vi/OcIb7FIzUo8/maxresdefault.jpg)
List the Contents of a tar, tar.gz, tar.bz2 Files File extensionĬool Tip: No more wasted time! Download from the web and untar in one step from the Linux command line! Read more → Untar tar, tar.gz, tar.bx2 FilesĮxtract and uncompress a tar.gz file: $ tar -xvzf Įxtract and uncompress a tar.bz2 file: $ tar -xvjf 2 Optionĭecompress the contents of the compressed archive created by gzip program ( tar.gz)ĭecompress the contents of the compressed archive created by bzip2 program ( tar.bz2) You will learn how to list the contents of a tar archive without unpacking it and how to extract only a single file or a single directory.
![tar gz unzip tar gz unzip](https://www.partitionwizard.com/images/uploads/articles/2020/12/open-tar-file/open-tar-file-thumbnail.jpg)
The following article will help you to extract (unpack) and uncompress (untar) – tar, tar.gz and tar.bz2 files from the Linux command line. Most of the Linux files that can be downloaded from the Internet are compressed with a tar, tar.gz and tar.bz2 compression formats and it is important to know how to extract such files.