Software & Apps Linux How to Extract 'tar.gz' Files in Linux A simple command decompresses and expands tarballs by Gary Newell Writer Gary Newell was a freelance contributor, application developer, and software tester with 20+ years in IT, working on Linux, UNIX, and Windows. our editorial process Gary Newell Updated on December 08, 2019 Hero Images / Getty Images Linux Switching from Windows Tweet Share Email A file with the extension .gz has been compressed using the gzip command. A file with the extension .tar has been tarballed into a single archive. Thus, a .tar.gz file is a zipped tarball. Unpacking the Compressed Tarball Decompress the gzip file and extract the files from the tar file using a single command as follows: tar -xvzf FILENAME.tar.gz Listing the Contents of a 'tar.gz' File Be careful about extracting tar.gz files that you receive from other people or from download links as they may either deliberately or inadvertently harm your system. View the contents of a tar file using the following syntax: tar -tzf images.tar.gz The above command will show you the names and locations of the files that will be extracted. Be wary of tarbombing, or expanding tarballs that throw a lot of files in various places around your filesystem in ways that might sneak a malicious edit into your core system-config files.