Commands.page Logo

How to Extract tar.gz Files in Ubuntu Terminal

Working with compressed archives is a common task in Ubuntu, and the terminal offers the most efficient method to handle them. This guide explains the specific command needed to extract .tar.gz files quickly without needing graphical tools. You will learn the basic syntax and options to decompress these archives safely on your system.

To extract a .tar.gz file, open your terminal and navigate to the directory containing the archive using the cd command. Use the tar utility with specific flags to decompress the content in one step. The standard command structure is tar -xzvf filename.tar.gz.

Here is the breakdown of the flags used in this command:

Replace filename.tar.gz with the actual name of your file. If you need to extract the files into a specific directory instead of the current folder, add the -C flag followed by the destination path. For example, run tar -xzvf filename.tar.gz -C /path/to/directory. Once the command finishes running, the files will be available in the target location ready for use.