Untar File Linuxubuntu

Untar a File in Linux/Ubuntu

Written by: Ryan Frankel

Ryan Frankel

Ryan began developing websites in the late '90s and has personally tested just about every web host and cloud platform worth trying on the market today. With a masters degree in electrical and computer engineering from the University of Florida, he leverages his extensive knowledge of hardware, software, and their engineering relationship to inform HostingAdvice readers of the technical implications of their hosting choices. Ryan's subject matter expertise includes, but is not limited to, WordPress, cloud infrastructure management, product UI/UX design, and popular web development languages such as JavaScript and PHP.

See full bio »

Edited by: Lillian Castro

Lillian Castro

Lillian brings more than 30 years of editing and journalism experience to our team. She has written and edited for major news organizations, including The Atlanta Journal-Constitution and the New York Times, and she previously served as an adjunct instructor at the University of Florida. Today, she edits HostingAdvice content for clarity, accuracy, and reader engagement.

See full bio »

Usually a tar file is also compressed using either the gZip or bZip2 compressor. We’ll cover both.

1. If Your File Extension is .tar.gz (or .tgz)

If your tar file is compressed using a gZip compressor, use this command:

tar xvzf file.tar.gz

The options are pretty straightforward for this:

x: This tells tar to extract the files.

v: This option will list all of the files one by one in the archive. The “v” stands for “verbose.”

z: The z option is very important and tells the tar command to uncompress the file (gzip).

f: This options tells tar that you are going to give it a file name to work with.

2. If Your File Extension is .tar.bz2 (or .tbz)

If your tar file is compressed using a bZip2 compressor, use this command:

tar xvjf file.tar.tbz

This is just about the same as the gzip decompression. The major difference is that the z option has been replaced by the j option.

If you remember, the z option was the uncompress (specifically gzip) flag, so it makes sense that this would be switched out.

j: This will decompress a bzip2 file.

3. Mind-Blowingly-Simple Extraction (The dtrx Function)

There are only a handful of people that actually remember all of the options for the tar command. Luckily, Linux folks are great at making things easier.

Standing for “Do the Right Extraction,” dtrx works as you would hope. The command should be simple for both gZip and bZip2 files:

dtrx file.tar.gz
dtrx file.tar.bz2

Installing dtrx

To install dtrx, just use apt-get:

sudo apt-get install dtrx

Photo Sources: autogeekonline.net

Advertiser Disclosure

HostingAdvice.com is a free online resource that offers valuable content and comparison services to users. To keep this resource 100% free, we receive compensation from many of the offers listed on the site. Along with key review factors, this compensation may impact how and where products appear across the site (including, for example, the order in which they appear). HostingAdvice.com does not include the entire universe of available offers. Editorial opinions expressed on the site are strictly our own and are not provided, endorsed, or approved by advertisers.

Our Editorial Review Policy

Our site is committed to publishing independent, accurate content guided by strict editorial guidelines. Before articles and reviews are published on our site, they undergo a thorough review process performed by a team of independent editors and subject-matter experts to ensure the content’s accuracy, timeliness, and impartiality. Our editorial team is separate and independent of our site’s advertisers, and the opinions they express on our site are their own. To read more about our team members and their editorial backgrounds, please visit our site’s About page.

ABOUT THE AUTHOR

Ryan Frankel has been a professional in the tech industry for more than 20 years and has been developing websites for more than 25. With a master's degree in electrical and computer engineering from the University of Florida, he has a fundamental understanding of hardware systems and the software that runs them. Ryan now sits as the CTO of Digital Brands Inc. and manages all of the server infrastructure of their websites, as well as their development team. In addition, Ryan has a passion for guitars, good coffee, and puppies.

« BACK TO: HOW-TO
Follow the Experts
We Know Hosting

$

4

8

,

2

8

3

spent annually on web hosting!

Hosting How-To Guides