深度阅读

How to decompress a compressed tar archive in Linux?

作者
作者
2023年08月22日
更新时间
10.74 分钟
阅读时间
0
阅读量

To decompress a compressed tar archive in Linux, you can use the tar command with the appropriate options depending on the compression format. Here are some examples:

To decompress a tar.gz or .tgz file, use the -z option to enable gzip compression/decompression:

tar -xzvf archive.tar.gz

To decompress a tar.bz2 file, use the -j option to enable bzip2 compression/decompression:

tar -xjvf archive.tar.bz2

To decompress a tar.xz file, use the -J option to enable xz compression/decompression:

tar -xJvf archive.tar.xz

In each of these examples, x tells tar to extract files from the archive, v is for verbose mode, f specifies the filename of the archive, and the appropriate compression option is used (-z for gzip, -j for bzip2, and -J for xz).

Note that the tar command can also be used to create tar archives, in addition to extracting files from them. Also, depending on the distribution of Linux you’re using, tar may be installed by default, or you may need to install it using your package manager.

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。