如果你正在编码或只是从Github下载一个包,你可能会遇到TAR.GZ文件扩展名。TAR.GZ格式 ( TGZ ) 在(TGZ)Linux用户中很受欢迎,通常用于将文件集合打包成一个可下载的(package collections of files into a single downloadable).
但问题是,您究竟是如何打开TGZ文件的?你需要什么特殊的软件吗?或者您 PC 上的现有工具是否足够?让我们来了解一下。
TAR.GZ 文件格式(TAR.GZ File Format)简介
TAR.GZ文件是两种不同打包算法的组合。第一个是tar,磁带存档的缩写。这是一个古老的实用程序,主要用于将数据准确传输到没有自己的文件系统的设备。tar 文件(或 tarball)包含顺序格式的文件,以及有关目录结构和其他技术参数的元数据。
值得注意的是 tar 不会压缩有问题的文件,只会打包它们。事实上,有时生成的 tarball 会因为填充而变得更大。
这就是Gzip的用武之地。Gzip(由 .gz 文件扩展名表示)是一种压缩文件格式,用于归档数据以占用更小的空间。Gzip使用与更常见的 zip相同的压缩算法(same compression algorithm),但只能用于单个文件。简而言之,Gzip压缩所有单个文件并将它们 tar 打包到一个存档中。
因此,tar.gz 文件是使用 gzip 压缩的 tarball。要打开这样的包,您需要解压缩 gzip 并解压缩生成的 tarball。一些实用程序可以一步打开TGZ文件,而另一些则需要两步。(TGZ)
(Extract TAR.GZ Using)在Windows(Windows)中使用7-Zip提取 TAR.GZ
由于Windows本身不支持 tar.gz 文件,因此您需要第三方工具为您打开它们。大多数文件提取应用程序(如7-Zip 或 WinZip)(7-Zip or WinZip)都可以完成这项工作。
- 如果您还没有7-Zip ,请先在您的计算机上下载并安装它。
- 现在,导航到包含 tar.gz 文件的文件夹。
- 右键单击(Right-click)文件,将鼠标悬停在7-Zip选项上,然后选择Extract Here。这将产生另一个文件,这次只有一个TAR扩展名。
- 再次,右键单击这个新文件以使用 7-Zip 将其解压缩。这最终将为您提供实际的目录和文件。
在Linux中使用终端(Terminal)打开TGZ 文件(TGZ Files)
在基于Linux和 Unix 的系统中,提取(或创建)tar.gz 文件的命令是内置的。只需(Simply)在终端中输入以下命令:
tar -xvf 文件名.tar
在这里,您应该将文件名替换为相关文件的实际名称。您还需要位于包含 tar.gz 文件的目录中,就像Linux 中的大多数终端命令(terminal commands in Linux)一样。
Mac用户也可以使用此命令来提取他们的 tar.gz 文件,尽管他们也可以使用我们将在下一节中讨论的基于 GUI 的方法。
(Extract TAR.GZ Files)在Mac中使用Unarchiver提取 TAR.GZ 文件
您有多种方法可以在 Mac 中打开 tar.gz 文件。如果您对终端命令感到满意, Linux中使用的终端命令在这里工作得很好。
Mac 的本机存档实用程序也支持文件格式,这意味着您只需双击相关的 tar.gz 文件即可将其解压缩。当然,如果这不起作用(或者您只是更喜欢GUI工具),您可以随时下载Unarchiver并使用它来提取任何类型的存档文件,包括 gzip 压缩的 tarball。
使用在线工具打开 TGZ 文件
无需将特定应用程序下载到您的计算机或利用其内置功能,您可以使用在线应用程序提取 tar.gz 存档。许多网站允许您提取各种压缩文件,包括ZIP和TAR文件。
- 对于本指南,我们将使用Archive Extractor,但您可以使用任何其他在线工具。前往网站开始。
- 选择选择文件(Choose file)并上传要打开的 tar.gz 文件。该实用程序现在将提取存档,然后以正确的文件夹结构显示内容。
这种方法的一个优点是它可以在任何操作系统上使用,无论是Windows还是Mac,而不用担心原生支持。
打开TAR.GZ 文件(TAR.GZ Files)的最佳方法是什么?
访问 tar.gz 文件中包含的数据并不难。由于其年代久远和流行,存在多种提取此文件格式的方法,包括系统特定工具和外部工具。
在大多数平台中,您可能已经拥有正确的应用程序来提取和打开TGZ文件。Linux当然可以本地打开这些文件,而大多数Mac和Windows计算机上都安装了Unarchiver或 7-Zip 等软件。
所有平台上最简单的方法是使用在线提取工具。这样的实用程序可以在任何地方跨平台工作,为您省去找出提取 tar.gz 文件的正确方法的麻烦。
What Is a TAR.GZ File and How to Open It
If you are into сoding or just downloading a package from Github, you maу come across the TAR.GZ file extension. Populаr with Linux users, the TAR.GZ format (TGZ) is often used to package collections of files into a single downloadable.
But the question is, how exactly do you open TGZ files? Do you need any special software? Or are existing tools on your PC enough? Let’s find out.
Introduction to the TAR.GZ File Format
A TAR.GZ file is a combination of two different packaging algorithms. The first is tar, short for tape archive. It’s an old utility, invented mainly for accurate data transfer to devices without their own file systems. A tar file (or tarball) contains files in a sequential format, along with metadata about the directory structure and other technical parameters.
It is useful to note that tar doesn’t compress the files in question, only packages them. Indeed, sometimes the resulting tarball can be of greater size due to padding.
So that’s where Gzip comes in. Gzip (denoted by a .gz file extension) is a compressed file format used to archive data to take up smaller space. Gzip uses the same compression algorithm as the more commonly known zip but can only be used on a single file. In short, Gzip compresses all the individual files and tar packages them in a single archive.
So, a tar.gz file is a tarball compressed using gzip. To open such a package, you need to decompress the gzip and extract the resulting tarball. Some utilities can open TGZ files in one step, others in two.
Extract TAR.GZ Using 7-Zip in Windows
Since Windows doesn’t natively support tar.gz files, you need a third-party tool to open them for you. Most file extraction applications like 7-Zip or WinZip will get the job done.
- Begin by downloading and installing 7-Zip on your computer if you don’t already have it.
- Now, navigate to the folder containing your tar.gz file.
- Right-click on the file, hover over the 7-Zip option, and then select Extract Here. This will result in another file, this time with just a TAR extension.
- Once again, right-click on this new file to extract it using 7-Zip. This will finally give you the actual directories and files.
Open TGZ Files Using the Terminal in Linux
In Linux and Unix-based systems, the command to extract (or create) a tar.gz file is built-in. Simply enter the following command in the terminal:
tar -xvf filename.tar
Here you should replace the filename with the actual name of the file in question. You also need to be in the directory containing the tar.gz file, like with most terminal commands in Linux.
Mac users can also use this command to extract their tar.gz files, though they also have access to a GUI-based method we will discuss in the next section.
Extract TAR.GZ Files With the Unarchiver in Mac
You have multiple ways to open tar.gz files in Mac. The terminal command used in Linux works here just fine if you are comfortable with terminal commands.
Mac’s native archive utility supports the file format as well, which means you can just double-click on the tar.gz file in question to extract it. Of course, if that doesn’t work (or you just prefer a GUI tool), you can always download Unarchiver and use it to extract any type of archive files, including gzipped tarballs.
Open TGZ Files Using an Online Tool
Instead of downloading a specific application to your computer or leveraging its built-in abilities, you can extract your tar.gz archive using an online app. Many websites allow you to extract all kinds of compressed files, including ZIP and TAR files.
- For this guide, we will be using Archive Extractor, though you can use any other online tool. Head to the website to get started.
- Select Choose file and upload the tar.gz file you want to open. The utility will now extract the archive and then display the contents in the correct folder structure.
An advantage of this method is that it can be used on any operating system, whether Windows or Mac, without worrying about native support.
What Is the Best Method to Open TAR.GZ Files?
It is not that difficult to access the data contained in a tar.gz file. Thanks to its age and popularity, several methods exist to extract this file format, both system-specific and external tools.
In most platforms, the chances are that you already possess the right application to extract and open TGZ files. Linux, of course, can open these files natively, while most Mac and Windows computers have software like the Unarchiver or 7-Zip installed on them.
The easiest method on all platforms would be to use an online extraction tool. Such a utility works across platforms anywhere, saving you the hassle of figuring out the right way to extract a tar.gz file.