`

Linux tar

阅读更多
导读:
linux中有很多命令可以关于压缩的命令:tar,zip,compress;也有很多的压缩格式,tar,tar.gz,zip。对这些命令和格式有疑惑吗?他们的使用有什么区别呢?

摘要:
  • tar是solid compress,rar和7zip也是;而zip不是。
  • tar是把文件集合起来,然后用各种方式压缩,如果用gzip便压为tar.gz,如果用bzip2便压缩为tar.bz2。
  • 为适用MS-DOS's 8.3 filename limitations,tar.gz equals tgz,tar.bz2 equals tbz。


Details:
    tar files usually have the extension ".tar", as in somefile.tar As a pun, a tar file is commonly referred to as a tarball.[1]
One situation in which you may want to use tar is when you have a number of files which you want send online. If you email the files, you might be sending many attachments. If you post the files on a web page, you might have many links. You can use tar to avoid dealing with multiple files. You create one file, a tar file, into which you put your files. Then you can email this one tar file, or post it on a web page.
    Note that a tar file does not compress the files which it contains. To compress a tar file, you can use a variety of compression programs, such as gzip, bzip2, xz, lzip, lzma, or compress. For example, if you use gzip to compress a tar file, the resulting file might have the name somefile.tar.gz.
    (Alternatively, in the example above, instead of using a compressed tar file, you could put the files into a zip file. Simply, the difference between a zip file and a compressed tar file is that a zip file "compresses each file, and then merges the compressed files," whereas a compressed tar file "merges the files, and then compresses the big file." In other words, a zip file does not use solid compression, but a compressed tar file does.)
    Popular tar programs like the BSD and GNU versions of tar support the command line options -Z (compress), -z (gzip), and -j (bzip2) to automatically compress or decompress the archive file it is currently working with. GNU tar from version 1.20 onwards also supports --lzma (LZMA). 1.21 also supports lzop via --lzop, 1.22 adds support for xz via --xz or -J, and 1.23 adds support for lzip via --lzip.

    Tar archiving is often used together with a compression method, such as gzip, to create a compressed archive. As shown, the combination of the files in the archive are compressed as one unit.
MS-DOS's 8.3 filename limitations, and a desire for brevity, resulted in additional popular conventions for naming compressed tar archives, though this practice has declined with FAT offering long filenames.
.tgz is equivalent to .tar.gz
.tbz, .tbz2 and .tb2 are equivalent to .tar.bz2
.taz is equivalent to .tar.Z
.tlz is equivalent to .tar.lz
.txz is equivalent to .tar.xz

Usage:
tar -cf list.tar /com  # pack the files under /com to list.tar
tar -tf list.tar       # to see the files in the list.tar



references:
http://en.wikipedia.org/wiki/Tar_(file_format)

分享到:
评论

相关推荐

    linux下tar命令的使用

    在Linux操作系统中,`tar`命令是一个非常重要的工具,它用于处理档案文件,可以进行创建、提取、查看、归档等多个操作。`tar`的名字来源于“tape archive”,最初设计是用来备份数据到磁带上的,但现在它广泛应用于...

    linux tar命令例子

    在深入探讨Linux下的tar命令之前,我们先简要回顾一下tar命令的基本概念。tar,全称为tape archive,最初是用于磁带归档的一种工具,但随着时间的推移,它已经成为Unix和类Unix系统(包括Linux)中最常用的文件打包...

    linux下tar和zip压缩效率

    ### Linux下tar与zip压缩工具效率对比分析 #### 背景介绍 在Linux操作系统中,数据管理和存储是一项重要的任务。随着系统使用的深入,文件数量不断增多,如何有效地管理这些文件变得尤为关键。其中,文件的压缩处理...

    Linux tar 压缩打包命令使用方法第1/2页

    Linux tar 压缩打包命令使用方法 Linux tar 压缩打包命令是 Linux 操作系统中常用的压缩和打包工具。tar 命令可以将多个文件或目录压缩成一个文件,以便于存储和传输。下面是 tar 命令的使用方法和参数解释。 参数...

    Linux tar 命令出现 Cowardly refusing to create an empty archive 错误解决办法

    Linux tar 命令出现 Cowardly refusing to create an empty archive 错误解决办法 1 问题描述 写了一个 shell 脚本,执行时出现以下错误: 错误提示的字面意思是,系统惴惴不安地拒绝执行创建一个空压缩包的任务。P...

    linux-1.1.23.tar

    索下载你所需要的版本号的内核源代码范围从linux-1.0.tar到linux-2.6.29.tar,推荐朋友们用ultraedit去打开比较方便阅读,当然是自己喜 欢的阅读器就行了,也不一定用这个,不过这个阅读起来的确比较好用的!

    tar.bz2安装linux tar.bz2安装方法.doc

    tar.bz2 安装 Linux 软件的方法 tar.bz2 是一种常见的压缩文件格式,广泛应用于 Linux 操作系统中。今天,我们将学习如何在 Linux 中安装 tar.bz2 文件,并解释每个步骤的详细过程。 步骤 1: 使用 root 帐户登录 ...

    jdk1.6.0_191.linux.x64.tar.gz

    解压后使用方法:(不执行下面两步,运行java -version会报下面的错误,解压命令:tar xvzf jdk1.6.0_191.linux.x64.tar.gz) # Error occurred during initialization of VM # java/lang/NoClassDefFoundError: java...

    Linux网络操作系统基础:文件命令归档压缩命令tar和gzip.pptx

    Linux 网络操作系统基础:文件命令归档压缩命令 tar 和 gzip 在 Linux 操作系统中,文件命令是非常重要的基本组件之一。在这篇文章中,我们将介绍 Linux 中的文件命令,特别是归档压缩命令 tar 和 gzip。 gzip ...

    jdk1.7 64位官方版 jdk-7u79-linux-x64.tar.gz

    2. 使用解压命令(如tar -zxvf jdk-7u79-linux-x64.tar.gz)将内容解压到指定目录。 3. 设置环境变量,例如在~/.bashrc或~/.bash_profile文件中添加以下行: ```bash export JAVA_HOME=/path/to/your/jdk1.7.0_79 ...

    JDK-Linux的tar包

    例如,`sudo tar -zxf jdk-7uXX-linux-x64.tar.gz -C /usr/lib/jvm/jdk1.7.0` 和 `sudo tar -zxf jdk-8uXX-linux-x64.tar.gz -C /usr/lib/jvm/jdk1.8.0`。 4. **配置环境变量**:为了让系统能够识别和使用JDK,需要...

    android-studio-2020.3.1.23-linux.tar.gz

    Android Studio Arctic Fox(2020.3.1.23)开发工具版本适用 Linux系统,android-studio-2020.3.1.23-linux.tar.gz,它是Android Studio 4.2.2的下一个版本Android Studio 4.3。

    linux-2.6.26.tar

    linux-2.6.26.tar 安装 Iso 格式

    Zotero-5.0.93_linux-x86_64.tar.bz2(linux64)

    Zotero 是一个免费易用的 Firefox 扩展与客户端软件,可以协助我们收集、管理及引用研究资源,包括期刊、书籍等各类文献和网页、图片等。与Endnote等不同的是,它既可以单独使用,也可以内嵌于 Firefox 与 Google ...

    Redis7 linux tar 包

    缓存

    helm-v3.5.3-linux-amd64.tar.gz.asc

    helm-v3.5.3-linux-amd64.tar.gz.asc

    gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2

    gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2

    jdk1.8的Linux版本.tar.zip

    3. 解压文件:使用`tar`命令解压`.tar.gz`文件,例如:`tar -zxvf jdk1.8的Linux版本.tar.gz`。这将创建一个名为`jdk1.8`的目录,包含JDK的所有文件。 4. 设置环境变量:为了能够在系统中全局使用JDK,需要设置`JAVA...

    Linux tar命令用法详解

    Linux tar命令 Linux tar命令用于备份文件。 tar是用来建立,还原备份文件的工具程序,它可以加入,解开备份文件内的文件。 语法 tar [-ABcdgGhiklmMoOpPrRsStuUvwWxzZ][-b ][-C ][-f ][-F ][-K ][-L ][-N ][-T ][-...

Global site tag (gtag.js) - Google Analytics