
In this example we will extract file rar/rar.txt from archive.
LINUX UNTAR FILE ARCHIVE
We will specify the file or directory we want to extract after the archive name. In this example we will extract all content of the rarlinux-圆4-5.4.0.tar.gz $ tar -xvf rarlinux-圆4-5.4.0.tar.gz Extract Entire Archive Extract Single FileĪnother useful example is extracting single file from the tar.gz archive. We will use tar command with -xvf option. This will extract all file into new directory. The most used operation is extracting entire archive. In this example we will list contents of rarlinux-圆4-5.4.0.tar.gz $ tar -tvf rarlinux-圆4-5.4.0.tar.gz List Files and Directories Extract Entire Tar.gz Archive We will use tar command with -tvf option to list them. List Files and Directoriesīefore extracting or uncompressing the tar.gz file we generally need to list file and directories in the archive. gz command is used to compress, extract and list files and directories. Gz is the gzip format which is provided by all of the Linux, Unix and BSD files systems. Detailed tutorial about tar command be found in the following link. This is most used technique before compression.

Tar is very old and popular format used to put separate file and directories into single file.
LINUX UNTAR FILE HOW TO
In this tutorial we will look how to extract them easily. As a Linux system administrator we generally face with tar.gz extension files. A lot of files like source code, backup, configuration files etc. You can also extract some sub-directory: $ tar -xvf foo.Tar and gz formats very popular in Linux, Unix and BSD world. $ 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 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. List the Contents of a tar, tar.gz, tar.bz2 Files
LINUX UNTAR FILE DOWNLOAD
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. 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.
