unix bsd_如何在Linux,Unix和BSD中解压缩和解压缩Tar Gz文件

unix bsd

unix bsd

tar and gz formats very popular in Linux, Unix and BSD world. A lot of files like source code, backup, configuration files etc. are compressed with this two formats. As a Linux system administrator we generally face with tar.gz extension files. In this tutorial we will look how to extract them easily.

targz格式在Linux,Unix和BSD世界中非常流行。 这两种格式压缩了很多文件,如源代码,备份,配置文件等。 作为Linux系统管理员,我们通常会面对tar.gz扩展文件。 在本教程中,我们将研究如何轻松提取它们。

柏油 (Tar)

Tar is very old and popular format used to put separate file and directories into single file. This is most used technique before compression. Detailed tutorial about tar command be found in the following link.

Tar是非常古老且流行的格式,用于将单独的文件和目录放入单个文件中。 这是压缩前最常用的技术。 以下链接提供了有关tar命令的详细教程。

http://www.poftut.com/how-to-uncompress-and-untar-tar-gz-file-in-linux-unix-and-bsd/

http://www.poftut.com/how-to-uncompress-and-untar-tar-gz-file-in-linux-unix-and-bsd/

z (Gz)

Gz is the gzip format which is provided by all of the Linux, Unix and BSD files systems. gz command is used to compress, extract and list files and directories.

Gz是所有Linux,Unix和BSD文件系统提供的gzip格式。 gz命令用于压缩,提取和列出文件和目录。

列出文件和目录 (List Files and Directories)

Before extracting or uncompressing the tar.gz file we generally need to list file and directories in the archive. We will use tar command with -tvf option to list them. In this example we will list contents of rarlinux-x64-5.4.0.tar.gz

在提取或解压缩tar.gz文件之前,我们通常需要在归档文件中列出文件和目录。 我们将使用带有-tvf选项的tar命令列出它们。 在此示例中,我们将列出rarlinux-x64-5.4.0.tar.gz内容

$ tar -tvf rarlinux-x64-5.4.0.tar.gz
List Files and Directories
List Files and Directories
列出文件和目录

提取整个Tar.gz存档(Extract Entire Tar.gz Archive)

The most used operation is extracting entire archive. This will extract all file into new directory. We will use tar command with -xvf option. In this example we will extract all content of the rarlinux-x64-5.4.0.tar.gz

最常用的操作是提取整个存档。 这会将所有文件提取到新目录中。 我们将使用带有-xvf选项的tar命令。 在此示例中,我们将提取rarlinux-x64-5.4.0.tar.gz所有内容

$ tar -xvf rarlinux-x64-5.4.0.tar.gz
Extract Entire Archive
Extract Entire Archive
提取整个档案

提取单个文件(Extract Single File)

Another useful example is extracting single file from the tar.gz archive. We will specify the file or directory we want to extract after the archive name. In this example we will extract file rar/rar.txt from archive.

另一个有用的示例是从tar.gz存档中提取单个文件。 我们将在存档名称之后指定要提取的文件或目录。 在此示例中,我们将从存档中提取文件rar/rar.txt

$ tar -xvf rarlinux-x64-5.4.0.tar.gz  rar/rar.txt

提取多个文件 (Extract Multiple Files)

We can also extract multiple files without extracting the whole archive we will add all files and directories we want to extract one by by. In this example we want to extract rar/rar.txt and rar/license.txt from the archive.

我们也可以提取多个文件而无需提取整个档案,我们将添加我们要提取的所有文件和目录。 在此示例中,我们要从存档中提取rar/rar.txtrar/license.txt

$ tar -xvf rarlinux-x64-5.4.0.tar.gz  rar/rar.txt rar/license.txt
Extract Multiple Files
Extract Multiple Files
提取多个文件
LEARN MORE  7z Command Tutorial With Examples To Compress And Extract Files In Linux
了解更多7z命令教程,并提供在Linux中压缩和提取文件的示例

翻译自: https://www.poftut.com/how-to-uncompress-and-untar-tar-gz-file-in-linux-unix-and-bsd/

unix bsd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值