Tar Bz2 Extract Windows

Posted on by
Tar Bz2 Extract Windows Rating: 8,1/10 1573 votes

Topics and search suggestion about how to use free BZ2 software for Windows and Linux systems, work with BZ2 files compressor, opener, and extractor utility, how to create, extract (unzip), open Bzip2 compressed format (plain.bz2 extension, or Bzip2 compressed TAR / TBZ archives).

Link Type Windows Description; Download.exe: 32-bit x86: 7-Zip for 32-bit Windows: Download.exe: 64-bit x64: 7-Zip for 64-bit Windows x64 (Intel 64 or AMD64). Mar 20, 2008  Bzip2: file compressor Version. Bzip2 is a freely available, patent free, high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression. Alternatively, Right-click on tbz/tbz2/tb2/tar.bz2 file on Windows Explorer And then, choose Extract files., Extract Here, or Extract to 'folder ' to extract the tbz/tbz2/tb2/tar.bz2 file.

Tar files are compressed archives. You’ll encounter them frequently while using a Linux distribution like Ubuntu or even while using the terminal on macOS. Here’s how to extract—or untar—the contents of a tar file, also known as a tarball.

What Does .tar.gz and .tar.bz2 Mean?

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.

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. Someone somewhere is probably still using tar with tape.

The .gz or .bz2 extension suffix indicates that the archive has been compressed, using either the gzip or bzip2 compression algorithm. The tar command will work happily with both types of file, so it doesn’t matter which compression method was used—and it should be available everywhere you have a Bash shell. You just need to use the appropriate tar command line options.

Extracting Files from Tar Files

Let’s say you’ve downloaded two files of sheet music. One file is called ukulele_songs.tar.gz , the other is called guitar_songs.tar.bz2. These files are in the Downloads directory.

Let’s extract the ukulele songs:

As the files are extracted, they are listed in the terminal window.

The command line options we used are:

  • -x: Extract, retrieve the files from the tar file.
  • -v: Verbose, list the files as they are being extracted.
  • -z: Gzip, use gzip to decompress the tar file.
  • -f: File, the name of the tar file we want tar to work with. This option must be followed by the name of the tar file.

List the files in the directory with ls and you’ll see that a directory has been created called Ukulele Songs. The extracted files are in that directory. Where did this directory come from? It was contained in the tar file, and was extracted along with the files.

Now let’s extract the guitar songs. 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.

Once again, the files are listed to the terminal as they are extracted. To be clear, the command line options we used with tar for the .tar.bz2 file were:

  • -x: Extract, retrieve the files from of the tar file.
  • -v: Verbose, list the files as they are being extracted.
  • -j: Bzip2, use bzip2 to decompress the tar file.
  • -f: File, name of the tar file we want tar to work with.
Bz2

If we list the files in the Download directory we will see that another directory called Guitar Songs has been created.

Choosing Where to Extract the Files To

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.

Looking in our Documents/Songs directory we’ll see the Guitar Songs directory has been created.

Note that the target directory must already exist, tar will not create it if it is not present. If you need to create a directory and have tar extract the files into it all in one command, you can do that as follows:

The -p (parents) option causes mkdir to create any parent directories that are required, ensuring the target directory is created.

Looking Inside Tar Files Before Extracting Them

So far we’ve just taken a leap of faith and extracted the files sight unseen. You might like to look before you leap. 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.

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.

Scrolling through the output we can see that everything in the tar file is held within a directory called Ukulele Songs, and within that directory, there are files and other directories.

We can see that the Ukulele Songs directory contains directories called Random Songs, Ramones and Possibles.

To extract all the files from a directory within a tar file use the following command. Note that the path is wrapped in quotation marks because there are spaces in the path.

Tar Bz2 Extract Windows 6

To extract a single file, provide the path and the name of the file.

You can extract a selection of files by using wildcards, where * represents any string of characters and ? represents any single character. Using wildcards requires the use of the --wildcards option.

Extracting Files Without Extracting Directories

If you don’t want the directory structure in the tar file to be recreated on your hard drive, use the --strip-components option. The --strip-components option requires a numerical parameter. 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.

If we specify --strip-components=1 with our example tar file, the Ukulele Songs top-most directory within the tar file is not created on the hard drive. The files and directories that would have been extracted to that directory are extracted in the target directory.

There are only two levels of directory nesting within our example tar file. So if we use --strip-components=2, all the files are extracted in the target directory, and no other directories are created.

If you look at the Linux man page you’ll see that tar has got to be a good candidate for the title of “command having the most command line options.” Thankfully, to allow us to extract files from .tar.gz and tar.bz2 files with a good degree of granular control, we only need to remember a handful of these options.

READ NEXT
  • › How to Hide Twitter Replies
  • › How to Install Apps Directly On Your Apple Watch
  • › What Is a GIF, and How Do You Use Them?
  • › How to Protect Your Identity Online
  • › Microsoft Explains How “Cloud Download” Reinstalls Windows 10

Data compression has been extremely useful to us over the years. Whether its a zip file containing images to be sent in a mail or a compressed data backup stored on a server, we use data compression to save valuable hard drive space or to make the downloading of files easier. There are compression formats out there which allow us to sometimes compress our data by 60% or more. I’ll run you through using some of these formats to compress and decompress files and directories on a Linux machine. We’ll cover the basic usage of zip, tar, tar.gz and the tar.bz2 formats. These are some of the most popular formats for compression used on Linux machines.

Quick Note: If you’re looking for the Windows version of this tutorial, you can find it at How to Open tar.gz Files in Windows.

Tar Bz2 Extract Windows Xp

Before we delve into the usage of the formats I’d like to share some of my experience using the various formats of archiving. I’m talking about only a few data compression formats here, and there are many more out there. I’ve realized that I need two or three formats of compression that I’m comfortable using, and stick to them. The zip format is definitely one of them. This is because zip has become the de-facto standard choice for data compression, and it works on Windows as well. I use the zip format for files that I might need to share with Windows users. I like to use the tar.gz format for files that I would only use on my Mac and Linux machines.

Tar

ZIP

Zip is probably the most commonly used archiving format out there today. Its biggest advantage is the fact that it is available on all operating system platforms such as Linux, Windows, and Mac OS, and generally supported out of the box. The downside of the zip format is that it does not offer the best level of compression. Tar.gz and tar.bz2 are far superior in that respect. Let’s move on to usage now.

To compress a directory with zip do the following:

# zip -r archive_name.zip directory_to_compress

Here’s how you extract a zip archive:

# unzip archive_name.zip

TAR

Tar is a very commonly used archiving format on Linux systems. The advantage with tar is that it consumes very little time and CPU to compress files, but the compression isn’t very much either. Tar is probably the Linux/UNIX version of zip – quick and dirty. Here’s how you compress a directory:

# tar -cvf archive_name.tar directory_to_compress

And to extract the archive:

# tar -xvf archive_name.tar.gz

This will extract the files in the archive_name.tar archive in the current directory. Like with the tar format you can optionally extract the files to a different directory:

# tar -xvf archive_name.tar -C /tmp/extract_here/

Tar.gz Extract Windows 10

TAR.GZ

This format is my weapon of choice for most compression. It gives very good compression while not utilizing too much of the CPU while it is compressing the data. To compress a directory use the following syntax:

# tar -zcvf archive_name.tar.gz directory_to_compress

To decompress an archive use the following syntax: Viewpoint media player windows 10.

# tar -zxvf archive_name.tar.gz

This will extract the files in the archive_name.tar.gz archive in the current directory. Like with the tar format you can optionally extract the files to a different directory:

# tar -zxvf archive_name.tar.gz -C /tmp/extract_here/

TAR.BZ2

This format has the best level of compression among all of the formats I’ve mentioned here. But this comes at a cost – in time and in CPU. Here’s how you compress a directory using tar.bz2:

# tar -jcvf archive_name.tar.bz2 directory_to_compress

This will extract the files in the archive_name.tar.bz2 archive in the current directory. To extract the files to a different directory use:

# tar -jxvf archive_name.tar.bz2 -C /tmp/extract_here/

Data compression is very handy particularly for backups. So if you have a shell script that takes a backup of your files on a regular basis you should think about using one of the compression formats you learned about here to shrink your backup size.

Over time you will realize that there is a trade-off between the level of compression and the the time and CPU taken to compress. You will learn to judge where you need a quick but less effective compression, and when you need the compression to be of a high level and you can afford to wait a little while longer.