The following article will help you to extract (unpack) and uncompress (untar) how to accelerate your learning curve to 10x your personal growth – tar, tar.gz and tar.bz2 files from the Linux command line. You can open most .tar.gz files using the tar command built in to Linux, macOS, and Windows 10. If you’re not comfortable with the terminal or command line, third-party tools such as 7-Zip offer a more user-friendly alternative. It’s easy to get confused when navigating between .tar, .tar.gz, and .gz – not to mention zipping and unzipping them. Here are a few frequently asked questions we commonly hear from users working with .tar.gz files.
When you extract files from a .tar.gz archive, the checksum is automatically verified to detect & handle any potential data corruption. To do this we’ll use almost exactly the same command as before but with one important difference. 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 .gz or .bz2 extension suffix indicates that the archive has been compressed, using either the gzip or bzip2 compression algorithm.
- For 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.
- Where commands have little (if any) room for typos or omissions, many common errors are the result of small mistakes, misspellings, or incorrect formats.
- To extract all the files from a directory within a tar file use the following command.
- Any path that starts with a forward slash / is an absolute path.
- They were officially introduced in Ubuntu 16.04 LTS, released in April 2016.
For 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. 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. In this guide, you will learn how to extract or unzip .tar.gz files in Linux. That means users can download and use it for free during a trial period.
It was contained in the tar file, and was extracted along with the files. A file using .tar.gz format is a file that has been created using the Unix-based archival application tar and then compressed using the gzip compression. These files are often referred to as “tarballs.” While you can find them with a double extension (.tar.gz), the extension can also be shortened to .tgz or .gz. Since .tar.gz compresses multiple files all at once, it can take advantage of similarities between individual files to save on space.
From videos to entire software packages, many files are compressed and stored using the .tar.gz format. While extracting a .tar.gz file isn’t quite as easy as unzipping a .zip, it’s still pretty straightforward. Tar is an archiving program designed to store multiple files in a single file (an archive), and to manipulate such archives. The .gz extension indicates the gzip program is used for compression. 7-Zip is a free and open-source tool with high compression ratios & supports a wide range of archive formats.
Extracting .tar.gz Files for Windows
Notice that we don’t need to use the -z option to list the files. We only need to add the -z option when we’re extracting files from a .tar.gz file. Likewise, we don’t need the -j option to list the files in a tar.bz2 file. If we want to extract the files to a location other than the current directory, we can specify a target directory using the -C (specified directory) option.
Similar to the previous error, this error occurs when an archive was saved as a .tar despite not being a .tar archive. While there are many tools to choose from, the most popular include 7-Zip and WinZip. While slightly different, they are quite lightweight and offer a much simpler alternative to using the command line. You can also add the verbose output option (-v) to provide detailed listings, including dates, securities/permissions, and more.
Author’s note✍️
However, while tools like 7-Zip are free, many more “robust” solutions are only available for a price after a trial period. As a result, we recommend sticking to free (but trustworthy) tools or simply using the command line. To access the Windows command line, search for “command prompt” or “cmd” in the search bar. Right-click the first result and select the “Run as administrator” option. Ubuntu Core is a minimalistic and immutable version explicitly designed for the Internet of Things (IoT) and embedded systems. 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.
You can follow him on X (Twitter), YouTube, LinkedIn and About.me. On Windows 10, to use tar on Linux, you need to install the Windows Subsystem for Linux (WSL) and a distro like Ubuntu from the Microsoft Store. For more information and to schedule a live demo, contact a hosting expert from Kinsta today. 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. Canonical released its first official version of the OS, Ubuntu 4.10, codenamed ‘Warty Warthog’ in October 2004.
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 the license. Then we’ll jump into the step-by-step process of unzipping on both Linux and Windows platforms. If you plan to distribute and store .tar.gz files on your website, Kinsta’s managed hosting services can help make the most of your space.
Debian 11 ‘Bullseye’ Enters Long Term Support Phase
Someone somewhere is probably still using tar with tape. Tar stands for “tape archive” and is GNU software originally developed for backing up data to tape drives. It is still used today for consolidating and compressing data. Archives created with tar are typically saved with a .tar extension and can also be compressed to save space, resulting in files like .tar.gz or .tar.bz2. WinRAR is a popular file compression & archive utility software. It allows users to create, view, and extract files in various archive formats, including its native .RAR format as well as other common formats like .ZIP, .7z, ISO, .TAR, and more.
Though both .zip and .tar.gz archive and compress files, they do so in different ways. In other words, .zip is a collection of compressed files, while .tar.gz is a compressed collection of files. As we see later, different compression utilities may require different methods for extracting and unzipping files. Though we mostly focus on .tar.gz files, check out the end of the article for some quick tips on extracting .tar files in other formats. Just like the more familiar .zip files, .tar files compress large files into a single package, making it easier to store and send them through email, servers, and so on. As a result, it has become a common file extension for many open-source software packages and other resources.
How to Extract a tar.gz File to a Different Directory
When the archive is extracted, these attributes are restored. That means they maintain their original characteristics. This compression is lossless – that means no data is lost during the compression process, and the original files can be fully restored upon extraction. Files that have a .tar.gz or a .tar.bz2 extension are compressed archive files. A file with just a .tar extension is uncompressed, but those will be very rare. This error occurs when trying to extract specific files or directories from a .tar.gz file using tar.
In Linux, the term “untar command” isn’t a standalone command. Instead, it commonly refers to the process of extracting, unzipping, or uncompressing tar and tar.gz files from a tar archive. The actual command used for this purpose is the tar command, combined with specific extraction options or arguments, enabling you to untar files, as we will cover next. The .tar portion of the file extension stands for tape archive, and is the reason that both of these file types are called tar files. Tar files date all the way back to 1979 when the tar command was created to allow system administrators to archive files onto tape. Forty years later we are still using the tar command to extract tar files on to our hard drives.
If we list the files in the Download directory we will see that another directory called Guitar Songs has been created. This error occurs if you try to decompress a file without specifying a decompression utility, specifically -z for gzip. Some third-party tools also offer extended flexibility for converting between file types, saving more time if you want to change between compression formats. Knowing how to unzip a .tar.gz file allows users to extract and access the archives’ contents efficiently. Both commands will have the same effect, because current working directory doesn’t matter when you use absolute path. Any path that starts with a forward slash / is an absolute path.