6

如何解压Gz文件

 1 year ago
source link: https://www.myfreax.com/how-to-unzip-gz-file/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

如何解压Gz文件

Gzip是一种流行的压缩算法,可在保持原始文件模式,所有权和时间戳的同时减小文件大小

Updated At 2 Dec 2022 3 min read
By myfreax
如何解压Gz文件

如何解压Gz文件

Gzip是一种流行的压缩算法,可在保持原始文件模式,所有权和时间戳的同时减小文件大小。此算法通常用于压缩Web页面,以加快页面加载速度。

在Linux和macOS,您可以使用gzip命令解压.gz文件。gzip命令会将压缩文件恢复到原始状态,并删除.gz文件。

按照惯例,使用gzip压缩的文件以.gz .z结尾。本教程说明如何打开或解压.gz文件。

解压gz文件

如在引言提到,gzip命令在解压完成后,将会删除原始的压缩文件。如果你需要保留压缩文件,请使用gzip命令的-k选项解压文件。

另一个可用于解压.gz文件的命令是gunzipgunzip命令实质是命令gzip -d的别名。

要使用gunzip命令解压.gz文件,只需将文件名传递给gunzip命令,例如命令gunzip file.gzgunzip 默认不会删除原始压缩文件。

如果您使用的是GUI环境,而不是命令行,则可以使用文件管理器。打开或者解压.gz文件,请右键单击要解压缩的文件,然后选择提取

Windows用户需要安装7zip才能解压.gz文件。

gzip -dk file.gz
gunzip file.gz

tar 命令解压tar.gz文件

要解压tar.gz文件,请tar命令的使用--extract或者-x选项,并在-f选项后指定tar.xz文件文件名称。

tar自动检测压缩文件使用的算法并自动解压文件。可以使用tar -xf命令来解压使用其他压缩算法的tar存档文件。例如.tar.xz文件和.tar.bz文件。

命令tar -xf archive.tar.gz命令将会解压archive.tar.gz文件到当前目录。-f选项用于指定文件,-x选项表示解压。

tar -xf archive.tar.gz
how-to-create-and-extract-archives-using-the-tar-command-in-linux.webp

要解压.gz文件,请使用gunzip命令后跟文件名。如有任何疑问,请在下面发表评论。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK