Fedora

How to Extract a TGZ File on Fedora Linux

The full form of the “.tgz” extension is Tarball Gzipped, a common compressed archive format. The “.tgz” file format is famous for combining the file archiving with compression for efficient storage and file transfer while protecting their attributes. It is one of the best choices for different use cases such as backups, software distribution, and data archiving.

Almost every Linux distro, including Fedora Linux, supports the “.tgz” file. However, many beginners don’t know how to extract the “.tgz” file. If you also want to know how to extract a “.tgz” file on Fedora Linux, this quick guide is for you. Here, we include the different ways to extract the “.tgz” files without hassles.

How to Extract a TGZ File on Fedora Linux

This section includes a command line and a graphical method to extract the “.tgz” file on Fedora.

The Tar Command

It is simple to extract the “.tgz” file using the “tar” command. For instance, the “.tgz” file is present in the “Downloads” directory. First, run the following command to the directory in the terminal:

cd ~/Downloads
ls

As the previous image shows, the “Fedora.tgz” file is available in the “Downloads”.

Now, execute the following given command to extract the “.tgz” file:

tar -xvf <File>.tgz

The previous command includes multiple options such as:

  • -x option: Stands for extract
  • -v option: Stands for verbose that displays a detailed information about the extracted files
  • -f option: Uses the archive file in the process

You can add the “z” option with the “tar” command to keep the “.tgz” file after extracting it:

tar -xzvf <File>.tgz

In case you want to extract the file to the specific directory, you need to run the following command:

tar -xzvf <File>.tgz -C <path of the directory>

Replace <File>.tgz with the name of your “.tgz” file and <path of the directory> with the path to the directory where you want to extract the contents.

Let’s check if you successfully extracted the “.tgz” file into the specific directory. For example, we extract the files in the “Documents” directory:

cd ~/Documents
ls

Similarly, you can use the “-t” option to list the contents that are present in the “.tgz” file:

tar -tzvf <File>.tgz

Moreover, you can execute the following given command to explore more options of the “tar” command:

tar --help

The Simple Approach

If you don’t want to use the commands, you can extract the “.tgz” file from the File Manager. Locate to the File Manager and navigate to the directory where the “.tgz” file is available:

Now, right-click on the “.tgz” file. Here, you get the “Extract” option in the drop-down menu:

Furthermore, you can click on the “Extract to…” option to extract the “.tgz” file to a specific directory:

Conclusion

This is all about the simple methods to extract a “.tgz” file on Fedora Linux without facing any issues. With its versatile options, the “tar” command empowers you to manage the compressed archives effectively. Whether you’re a beginner or a Linux enthusiast, the given methods will help you to extract the “.tgz” files in your Fedora system.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.