How to Untar Unzip or Extract Tar Files in Unix or Linux

how to untar the tar.gz file

The c, v, z, and f flags used in the aforementioned command stand for Create, Verbose, gzip, and Filename. Ubuntu versions are usually named using an alliterative adjective and an animal name, both starting with the same letter. The Ubuntu logo, often called the “Circle of Friends,” comprises three people holding hands. It signifies the strong sense of community and interconnectedness at the core of Ubuntu’s philosophy.

These are popular for organizations and users who require a reliable and well-supported Ubuntu operating system. After reading this article, you know how to extract or unzip .tar.gz file in Linux using different methods and tools. I had a lot of fun, three years ago or so, running a bunch of tests with different compression methods, and it was very enlightening to see how various files took to compression. You’ll probably have to install the “other” tar (whatever that may be on your system) manually.

How to Create TAR and TAR.GZ Files

The number represents how many levels of directories to ignore. Files from the ignored directories are still extracted, but the directory structure is not replicated on your hard drive. So far we’ve just taken a leap of faith and extracted the files sight unseen. You can review the contents of a tar file before you extract it by using the -t (list) option. It is usually convenient to pipe the output through the less command.

The .bz2 extension suffix tells us it has been compressed using the bzip2 command. Instead of using the-z (gzip) option, we will use the -j (bzip2) option to unzip the bz2 file. The most often used algorithm for compressing tar files is Gzip. By convention, the name of a tar archive compressed with gzip becomes .tar.gz or .tgz. The Dolphin file manager offers a feature to autodetect whether the files extracted from an archive are contained in a directory or if a new directory needs to be created for them.

Untar Tar.gz – Linux Tar Command – HowTo: Extract Tar File

Decompressing TAR and TAR.GZ files is only a matter of few clicks using the GUI. Similarly, you can unzip specific directories from the archive as well. You can choose which files to extract from the archive. To do so, simply pass the file names with the default command.

  1. Decompressing TAR and TAR.GZ files is only a matter of few clicks using the GUI.
  2. The following tar examples cover how to untar both popular formats and extract the contents of the compressed archive to a different directory.
  3. Users can utilize the 7-zip command-line interface for automated & scripted extraction tasks.
  4. Now the file “four” is extracted to a new directory called “bar.” If “bar” already exists, then “four” is placed inside the existing directory.
  5. These are popular for organizations and users who require a reliable and well-supported Ubuntu operating system.

These kinds of archives are sometimes called a tarbomb, although not always with a negative connotation. Tarbombs are useful for patches and software installers; it’s just a matter of knowing when to use them and when to avoid them. In Linux, users have multiple ways to extract .tar.gz files – through the terminal and graphical file archivers. The terminal method is only recommended for those comfortable with command-line interactions, while graphical file archivers provide a user-friendly experience and are good for beginners. This format is common in the Unix/Linux world and is widely used to create compressed archives.

How to unzip a tar.gz file

The name “Tar” stands for “Tape Archiver” because it was used to place data on storage tapes when tar was invented. The tar program takes one or more files and “wraps” them into a self-contained file. A user-friendly way to extract files from a .tar.gz archive is via a Graphical User Interface (GUI). A GUI is more suitable for beginners than a command-line tool.

It is based on Ubuntu and tailored for use in scenarios where reliability, security, and ease of maintenance are critical, relying on the Snap package and atomic transactional updates. This example uses example1.tar.gz in the Home directory. The output shows a newly created archive example1.tar.gz. The tar format is just a format, and it’s an open format, so it can be created by more than just one tool.

This places all of the files in the archive neatly into the “newfiles” directory. You may also be interested in learning about the best WinZip alternatives to compress files. These files can be used in incremental backup strategies – where only new or modified files are added to the archive.

how to untar the tar.gz file

It just bundles files & directories together while preserving their file structure and metadata. This means it takes all the specified files and puts them together into one container. Looking in our Documents/Songs directory we’ll see the Guitar Songs directory has been created. Snaps were developed by Canonical, the company behind Ubuntu, to package and distribute software focusing on security, sandboxing, and ease of installation and updates. They were officially introduced in Ubuntu 16.04 LTS, released in April 2016.

Choosing Where to Extract the Files To

Once you’re comfortable with the basics, it’s useful to explore other features. That means users can download and use it for free during a trial period. Also, its trial version does not have time limitations, and users can still use it even after the trial period has expired, with occasional reminders to purchase what is meant by lifo and fifo the license. This simplifies file management and reduces the risk of data loss during transfers. Connect and share knowledge within a single location that is structured and easy to search. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004.

Ubuntu is a Southern African philosophy and term originating from South Africa and Zimbabwe. Most Linux distributions come with the tar command pre-installed by default. We can see that the Ukulele Songs directory contains directories called Random Songs, Ramones and Possibles. Use the –exclude flag to specify the names of the files that you don’t want to extract. You can combine both steps into a single command as well.

Post a comment

Categories