植村秀属于什么档次| 双离合是什么意思| 官杀混杂是什么意思| 前羽念什么| 橡皮泥能做什么| loser是什么意思| pt是什么单位| 七月五日是什么星座| 胎心停了是什么原因引起的| 什么是尊严| 1992年是什么年| 什么猫| 肚子胀打嗝是什么原因| 和合双全是什么生肖| 今年27岁属什么生肖| 婴儿外阴粘连挂什么科| 盆腔积液用什么药| 龟头敏感早泄吃什么药| 7月5号是什么星座| 嘴巴干是什么原因| 闭口粉刺是什么原因引起的| 无故流鼻血是什么原因| 羡慕的意思是什么| 夏季摆摊卖什么好| 有点拉肚子吃什么药| 为什么哭了眼睛会肿| sy是什么意思| 为什么手会不自觉的抖| 妥了是什么意思| 什么是音色| dan什么意思| 胃功能三项检查是什么| 六月是什么季节| 厨房墙砖什么颜色好看| 下眼袋大是什么原因引起的| 四物汤什么时候喝最好| 笑对人生是什么意思| 肛门下坠感是什么症状| 肚脐眼周围痛挂什么科| hm是什么品牌| 报复是什么意思| 手机电池是什么电池| 什么生肖带红花| 黑匣子是什么颜色| 白茶和绿茶有什么区别| 什么的工作| 飞机为什么不能说一路顺风| 来大姨妈肚子疼是什么原因| 尿白细胞阳性什么意思| 血清是什么意思| 吃什么补钙快| 为什么时间越来越快| 做什么生意| 骨挫伤是什么意思| 头爱出汗是什么原因引起的| 武五行属什么| 左心室高电压是什么意思| 因子是什么意思| 樱桃有什么营养价值| 左心增大是什么意思| 一九三五年属什么生肖| 前胸疼是什么原因| 96年是什么年| 闻思修是什么意思| 京东pop是什么意思| autumn是什么意思| 只羡鸳鸯不羡仙是什么意思| 肾彩超能查出什么| 尿常规隐血弱阳性什么意思| 皂苷是什么| 乙肝表面抗体弱阳性是什么意思| 牛逼是什么意思| 土方是什么| 丰的部首是什么偏旁| 三顾茅庐什么意思| 上位者是什么意思| 脚气是什么样的图片| 丢是什么意思| 什么是像素| 梦见和婆婆吵架是什么意思| 有黄痰吃什么药| 心脏跳快吃什么药好| 急性肠胃炎有什么症状| 生殖疱疹用什么药效果好| 一案双查是什么意思| 自主意识是什么意思| 水肿是什么| 什么的植物| 腱鞘炎是什么原因引起的| 喝桑叶茶有什么好处| 大便不规律是什么原因| 11月份是什么星座的| 仙草是什么| 半边脸疼是什么原因| 2035年属什么生肖| 脱疽是什么意思| 红斑狼疮是什么症状能治好吗| low什么意思| 破伤风疫苗什么时候打| psa是什么| 算了吧什么意思| 10月份是什么星座| 睾丸肿大是什么原因| 什么是宫腔镜手术| 一什么香蕉| 洛神花茶有什么功效| 妙不可言是什么意思| 小腿肚疼是什么原因| 才美不外见的见是什么意思| 早上醒来手麻是什么原因| 鬼是什么意思| 3月27日什么星座| 怀孕乳头会有什么变化| 梦见生孩子是什么意思解梦| 欢是什么动物| 什么其不什么| 非农业户口是什么意思| 红牛加什么提高性功能| 乌龙茶适合什么季节喝| 人这一生什么最重要| loft是什么意思| 额头上长痘痘是什么原因引起的| ccp抗体是什么意思| 蚊子最怕什么植物| 曹休和曹操什么关系| 雀舌是什么茶| 炎性结节是什么意思| 彩霞是什么意思| 坠积效应是什么意思| 存款到100万算什么阶层| 11月2号是什么星座| 生物钟什么意思| 加拿大的国宝是什么动物| 低烧什么症状| 论是什么意思| 距骨在什么位置| 先什么后什么| 吃什么能提高代谢| 鲫鱼喜欢吃什么| 冬天送什么礼物| 官杀是什么意思| 巨无霸是什么意思| 纹绣是什么| 屁股疼挂什么科| 豆腐是什么意思| 磷脂是什么东西| 悠悠岁月什么意思| 白带是什么意思| 什么的英语单词| 笑是什么意思| 德艺双馨什么意思| 胎儿腹围偏大说明什么| 胃寒湿气重吃什么药效果最好| 为什么会有黑头| 处理是什么意思| 维生素c什么时候吃效果最好| 入睡难一般是什么原因造成的| 便秘用什么药| 什么是心脏病| 一个木一个号念什么| q1什么意思| 乳头刺痛什么原因| wpw综合症是什么意思| EV71疫苗是什么| 命运多折 什么生肖| ckd5期是什么意思| 重阳节吃什么好| 旦角是什么意思| 高血糖适合吃什么水果| 伤口不容易愈合是什么原因| 2002年属马的是什么命| 判缓刑是什么意思| 鼻梁痛什么原因引起的| 7月30日什么星座| 地奥司明片治疗什么病| 免疫力低下吃什么好| 心脏早搏有什么危险| 秦始皇的名字叫什么| 29是什么生肖| 大殓是什么意思| 坐飞机不能带什么| 体会是什么意思| 94是什么意思| 捉摸不透是什么意思| 肾病吃什么水果好| 胃胀反酸吃什么药| 吃什么能提高免疫力| 五彩的什么| 命格是什么| 左心室舒张功能减退是什么意思| 内膜b型是什么意思啊| 杵状指常见于什么病| 月经来潮是什么意思| 甲状腺低回声什么意思| 龙头烤是什么鱼| 怀孕两天会有什么反应| 躲春是什么意思| 耳朵会动的人说明什么| 吃什么可以快速排便| 什么是胆囊炎| 总掉头发是什么原因| by是什么意思| haze是什么意思| 缺钾挂什么科| 宠物蛇吃什么| 医院有什么科室| 脑梗吃什么鱼最好| 娃娃亲是什么| 狗狗吐黄水是什么原因| 耳结是什么原因造成的| 川崎病是什么症状| baron是什么意思| 3月28日是什么星座| 阑尾炎在什么位置疼| 30年婚姻叫什么婚| 肌肉萎缩看什么科| 并发是什么意思| 鼻窦炎吃什么药好得快| 血糖高适合吃什么主食| 膝盖疼吃什么药| 心脏瓣膜关闭不全吃什么药| 7.6什么星座| 安陵容为什么恨甄嬛| 牙齿发酸是什么原因| 精液是什么味道的| 老梗是什么病| 紫微斗数是什么| 甲状腺功能减退是什么意思| 宫代表什么生肖| 阳萎早谢吃什么药最好| 双肺呼吸音粗是什么意思| 痔疮是什么原因引起的| 心肌酶是什么| 香港的海是什么海| 什么动物最没有方向感| 胆汁淤积症有什么症状| 梨子煮水喝有什么功效| 鲣鱼是什么鱼| 一直流鼻血是什么原因| 解表散热什么意思| 绿萝叶子发黄是什么原因| 咳嗽吃什么食物好得快| 拍大腿内侧有什么好处| 破溃是什么意思| 一什么点心| 话说多了声音嘶哑是什么原因| 马赫是什么意思| 发烧吃什么药退烧快| 每天喝酸奶有什么好处和坏处| 五月十四号是什么情人节| 吃芒果有什么坏处| 什么的鸽子| 姜太公钓鱼愿者上钩是什么意思| 什么人不能喝丹参| TA什么意思| 什么是心脏造影| 红米饭是什么米| 先敬罗衣后敬人是什么意思| 吃什么水果对皮肤好又美白| 亚裔人是什么意思| 虾与什么食物相克| 百合花什么时候种植| acne是什么意思| 安徽简称什么| 百度Jump to content

保卫萝卜无限金币版 for android V1.0.9 安卓版

From Wikipedia, the free encyclopedia
tar
Original author(s)Bell Laboratories
Developer(s)Various open-source and commercial developers
Initial releaseJanuary 1979; 46 years ago (1979-01)
Stable release(s)
BSD tar3.7.2[1] / 2025-08-06
GNU tar1.35[2] Edit this on Wikidata / 2025-08-06
pdtar2025-08-06[3][4] / 2025-08-06
Plan 9 tar? / ?
star2025-08-06[5] / 2025-08-06
Written inpdtar, star, Plan 9, GNU: C
Operating systemUnix, Unix-like, Plan 9, Microsoft Windows, IBM i
PlatformCross-platform
TypeCommand
LicenseBSD tar: BSD-2-Clause
GNU tar: GPL-3.0-or-later
pdtar: Public domain
Plan 9: MIT
star: CDDL-1.0
tar
Filename extension
.tar
Internet media type
application/x-tar
Uniform Type Identifier (UTI)public.tar-archive
Magic numberu s t a r \0 0 0  at byte offset 257 (for POSIX versions) 百度 2017年上汽新能源和互联网等自主创新产品销量实现迅猛增长,销售数字的强力攀升,背后是上汽在新四化方面的大力布局,以及自主技术的强大支撑。

u s t a r \040 \040 \0  (for old GNU tar format)[6]

absent in pre-POSIX versions
Latest release
various
various
Type of formatFile archiver
StandardPOSIX since POSIX.1, presently in the definition of pax[1]
Open format?Yes

In computing, tar is a shell command for combining multiple computer files into a single archive file. It was originally developed for magnetic tape storage – reading and writing data for a sequential I/O device with no file system, and the name is short for the format description "tape archive". When stored in a file system, a file that tar reads and writes is often called a tarball.

A tarball contains metadata for the contained files including the name, ownership, timestamps, permissions and directory organization. As a file containing other files with associated metadata, a tarball is useful for software distribution and backup.

POSIX abandoned tar in favor of pax, yet tar continues to have widespread use.

History

[edit]

The command was introduced to Unix in January 1979, replacing the tp program (which in turn replaced "tap").[7] The file structure was standardized in POSIX.1-1988[8] and later POSIX.1-2001,[9] and became a format supported by most modern file archiving utilities. The tar command was abandoned in POSIX.1-2001 in favor of pax, which was to support the ustar file format, and tar was indicated for withdrawal in favor of pax at least since 1994. None-the-less, many operating systems today include tools for tar files, as well as tools to compress and decompress them, such as xz, gzip, and bzip2.

The tar command was ported to the IBM i operating system.[10]

BSD-tar has been in Windows since 2018,[11][12] and there are other third-party tools available for Windows.

Rationale

[edit]

Many historic tape drives read and write variable-length data blocks, leaving significant wasted space on the tape between blocks (for the tape to physically start and stop moving). Some tape drives (and raw disks) support only fixed-length data blocks. Also, when writing to any medium such as a file system or network, it takes less time to write one large block than many small blocks. Therefore, the tar command writes data in records of many 512 B blocks. The user can specify a blocking factor, which is the number of blocks per record. The default is 20, producing 10 KiB records.[13]

File format

[edit]

There are multiple tar file formats, including historical and current ones. Two tar formats are codified in POSIX: ustar and pax. Not codified but still in current use is the GNU tar format.

A tar archive consists of a series of file objects, hence the popular term tarball, referencing how a tarball collects objects of all kinds that stick to its surface. Each file object includes any file data, and is preceded by a 512-byte header record. The file data is written unaltered except that its length is rounded up to a multiple of 512 bytes. The original tar implementation did not care about the contents of the padding bytes, and left the buffer data unaltered, but most modern tar implementations fill the extra space with zeros.[14] The end of an archive is marked by at least two consecutive zero-filled records. (The origin of tar's record size appears to be the 512-byte disk sectors used in the Version 7 Unix file system.) The final block of an archive is padded out to full length with zeros.

[edit]

The file header record contains metadata about a file. To ensure portability across different architectures with different byte orderings, the information in the header record is encoded in ASCII. Thus if all the files in an archive are ASCII text files, and have ASCII names, then the archive is essentially an ASCII text file (containing many NUL characters).

The fields defined by the original Unix tar format are listed in the table below. The link indicator/file type table includes some modern extensions. When a field is unused it is filled with NUL bytes. The header uses 257 bytes, then is padded with NUL bytes to make it fill a 512 byte record. There is no "magic number" in the header, for file identification.

Pre-POSIX.1-1988 (i.e. v7) tar header:

Field offset Field size Field
0 100 File path and name
100 8 File mode (octal)
108 8 Owner's numeric user ID (octal)
116 8 Group's numeric user ID (octal)
124 12 File size in bytes (octal)
136 12 Last modification time in numeric Unix time format (octal)
148 8 Checksum for header record
156 1 Link indicator (file type)
157 100 Name of linked file

The pre-POSIX.1-1988 Link indicator field can have the following values:

Link indicator field
Value Meaning
'0' or (ASCII NUL) Normal file
'1' Hard link
'2' Symbolic link

Some pre-POSIX.1-1988 tar implementations indicated a directory by having a trailing slash (/) in the name.

Numeric values are encoded in octal numbers using ASCII digits, with leading zeroes. For historical reasons, a final NUL or space character should also be used. Thus although there are 12 bytes reserved for storing the file size, only 11 octal digits can be stored. This gives a maximum file size of 8 gigabytes on archived files. To overcome this limitation, in 2001 star introduced a base-256 coding that is indicated by setting the high-order bit of the leftmost byte of a numeric field.[citation needed] GNU-tar and BSD-tar followed this idea. Additionally, versions of tar from before the first POSIX standard from 1988 pad the values with spaces instead of zeroes.

The checksum is calculated by taking the sum of the unsigned byte values of the header record with the eight checksum bytes taken to be ASCII spaces (decimal value 32). It is stored as a six digit octal number with leading zeroes followed by a NUL and then a space. Various implementations do not adhere to this format. In addition, some historic tar implementations treated bytes as signed. Implementations typically calculate the checksum both ways, and treat it as good if either the signed or unsigned sum matches the included checksum.

Unix filesystems support multiple links (names) for the same file. If several such files appear in a tar archive, only the first one is archived as a normal file; the rest are archived as hard links, with the "name of linked file" field set to the first one's name. On extraction, such hard links should be recreated in the file system.

UStar format

[edit]

Most modern tar programs read and write archives in the UStar (Unix Standard TAR[7][15]) format, introduced by the POSIX IEEE P1003.1 standard from 1988. It introduced additional header fields. Older tar programs will ignore the extra information (possibly extracting partially named files), while newer programs will test for the presence of the "ustar" string to determine if the new format is in use.

The UStar format allows for longer file names and stores additional information about each file. The maximum filename size is 255, but it is split among a preceding path "filename prefix" and the filename itself, so can be much less.[16]

Field offset Field size Field
0 156 (Several fields, same as in the old format)
156 1 Type flag
157 100 (Same field as in the old format)
257 6 UStar indicator, "ustar", then NUL
263 2 UStar version, "00"
265 32 Owner user name
297 32 Owner group name
329 8 Device major number
337 8 Device minor number
345 155 Filename prefix

The type flag field can have the following values:

Type flag field
Value Meaning
'0' or (ASCII NUL) Normal file
'1' Hard link
'2' Symbolic link
'3' Character special
'4' Block special
'5' Directory
'6' FIFO
'7' Contiguous file
'g' Global extended header with meta data (POSIX.1-2001)
'x' Extended header with metadata for the next file in the archive (POSIX.1-2001)
'A'–'Z' Vendor specific extensions (POSIX.1-1988)
All other values Reserved for future standardization

POSIX.1-1988 vendor specific extensions using link flag values 'A'–'Z' partially have a different meaning with different vendors and thus are seen as outdated and replaced by the POSIX.1-2001 extensions that also include a vendor tag.

Type '7' (Contiguous file) is formally marked as reserved in the POSIX standard, but was meant to indicate files which ought to be contiguously allocated on disk. Few operating systems support creating such files explicitly, and hence most TAR programs do not support them, and will treat type 7 files as if they were type 0 (regular). An exception is older versions of GNU tar, when running on the MASSCOMP RTU (Real Time Unix) operating system, which supported an O_CTG flag to the open() function to request a contiguous file; however, that support was removed from GNU tar version 1.24 onwards.

POSIX.1-2001/pax

[edit]

In 1997, Sun proposed a method for adding extensions to the tar format. This method was later accepted for the POSIX.1-2001 standard. This format is known as extended tar format or pax format. The new tar format allows users to add any type of vendor-tagged vendor-specific enhancements. The following tags are defined by the POSIX standard:

  • atime, mtime: all timestamps of a file in arbitrary resolution (most implementations use nanosecond granularity)
  • path: path names of unlimited length and character set coding
  • linkpath: symlink target names of unlimited length and character set coding
  • uname, gname: user and group names of unlimited length and character set coding
  • size: files with unlimited size (the historic tar format is 8 GB)
  • uid, gid: userid and groupid without size limitation (the historic tar format is limited to a max. id of 2097151)
  • a character set definition for path names and user/group names (UTF-8)

In 2001, the Star program became the first tar to support the new format.[citation needed] In 2004, GNU tar supported the new format,[17] though it does not write it as its default output from the tar program yet.[18]

The pax format is designed so that all implementations able to read the UStar format will be able to read the pax format as well. The only exceptions are files that make use of extended features, such as longer file names. For compatibility, these are encoded in the tar files as special x or g type files, typically under a PaxHeaders.XXXX directory.[19]:?exthdr.name? A pax-supporting implementation would make use of the information, while non-supporting ones like 7-Zip would process them as additional files.[20]

Features of the archival utilities

[edit]

Besides creating and extracting archives, the functionality of the various archival utilities varies. For example, implementations might automatically detect the format of compressed TAR archives for extraction so the user does not have to specify it, and let the user limit adding files to those modified after a specified date.[21][22]

Uses

[edit]

Command syntax

[edit]
tar [-options] <name of the tar archive> [files or directories which to add into archive]

Basic options:

  • -c, --create — create a new archive;
  • -a, --auto-compress — additionally compress the archive with a compressor which will be automatically determined by the file name extension of the archive. If the archive's name ends with *.tar.gz then use gzip, if *.tar.xz then use xz, *.tar.zst for Zstandard etc.;
  • -r, --append — append files to the end of an archive;
  • -x, --extract, --get — extract files from an archive;
  • -f, --file — specify the archive's name;
  • -t, --list — show a list of files and folders in the archive;
  • -v, --verbose — show a list of processed files.

Basic usage

[edit]

Create an archive file archive.tar from the file README.txt and directory src:

$ tar -cvf archive.tar README.txt src

Extract contents for the archive.tar into the current directory:

$ tar -xvf archive.tar

Create an archive file archive.tar.gz from the file README.txt and directory src and compress it with gzip :

$ tar -cavf archive.tar.gz README.txt src

Extract contents for the archive.tar.gz into the current directory:

$ tar -xvf archive.tar.gz

Tarpipe

[edit]

A tarpipe is the method of writing an archive to standard output and piping it to another tar process on its standard input, working in another directory, where it is unpacked. This process copies an entire source directory tree including all special files, for example:

$ tar cf - srcdir | tar x -C destdir

Software distribution

[edit]

The tar format continues to be used extensively for open-source software distribution. *NIX-distributions use it in various source- and binary-package distribution mechanisms, with most software source code made available in compressed tar archives.[citation needed]

Limitations

[edit]

The original tar format was created in the early days of Unix, and despite current widespread use, many of its design features are considered dated.[23]

Other formats have been created to address the shortcomings of tar.

File names

[edit]

Due to the field size, the original TAR format was unable to store file paths and names in excess of 100 characters.

To overcome this problem while maintaining readability by existing TAR utilities, GNU tar stores file paths and names in excess of the 100 characters are stored in @LongLink entries that would be seen as ordinary files by TAR utilities unaware of this feature.[24] Similarly, the PAX format uses PaxHeaders entries.[25]

Attributes

[edit]

Many older tar implementations do not record nor restore extended attributes (xattrs) or access-control lists (ACLs). In 2001, Star introduced support for ACLs and extended attributes, through its own tags for POSIX.1-2001 pax. bsdtar uses the star extensions to support ACLs.[26] More recent versions of GNU tar support Linux extended attributes, reimplementing star extensions.[27] A number of extensions are reviewed in the filetype manual for BSD tar, tar(5).[26]

Tarbomb

[edit]

A tarbomb, in hacker slang, is a tarball containing a large number of items whose contents are written to the current directory or some other existing directory when untarred instead of the directory created by the tarball specifically for the extracted outputs. [28] It is at best an inconvenience to the user, who is obliged to identify and delete a number of files interspersed with the directory's other contents. Such behavior is considered bad etiquette on the part of the archive's creator.

A related problem is the use of absolute paths or parent directory references when creating tar files. Files extracted from such archives will often be created in unusual locations outside the working directory and, like a tarbomb, have the potential to overwrite existing files. However, modern versions of FreeBSD and GNU tar do not create or extract absolute paths and parent-directory references by default, unless it is explicitly allowed with the flag -P or the option --absolute-names. The bsdtar program, which is also available on many operating systems and is the default tar implementation on Mac OS X v10.6, also does not follow parent-directory references or symbolic links.[29][failed verification]

If a user has only a very old tar available, which does not feature those security measures, these problems can be mitigated by first examining a tar file using the command tar tf archive.tar, which lists the contents and allows to exclude problematic files afterwards. These commands do not extract any files, but display the names of all files in the archive. If any are problematic, the user can create a new empty directory and extract the archive into it—or avoid the tar file entirely. Most graphical tools can display the contents of the archive before extracting them. Vim can open tar archives and display their contents. GNU Emacs is also able to open a tar archive and display its contents in a dired buffer.

Random access

[edit]

The tar format was designed without a centralized index or table of content for files and their properties for streaming to tape backup devices. Instead, the metadata for each file (such as name, size, time stamps) for each file is stored in a header before each file. The archive must be read sequentially to list or extract files. For large tar archives, this causes a performance penalty, making tar archives unsuitable for situations that often require random access to individual files.

In turn, this design makes TAR archives resilient against damage from missing portions, in both the form of digital files and physical tape.[citation needed] A truncated TAR file with missing parts on either ends still allows recovering the parts that are not missing, including the file paths and file names and metadata, by starting from the first TAR header that is not missing.[30]

With a well-formed tar file stored on a seekable (i.e. allows efficient random reads) medium, the tar program can still relatively quickly (in linear time relative to file count) look for a file by skipping file reads according to the "size" field in the file headers. This is the basis for option -n in GNU tar. When a tar file is compressed whole, the compression format, being usually non-seekable, prevents this optimization from being done.[31] To maintain seekability, tar files must be also concatenated properly, by removing the trailing zero block at the end of each file.[32]

Duplicates

[edit]

Another issue with tar format is that it allows several (possibly different) files in archive to have identical paths and filenames. When extracting such archive, usually the latter version of a file overwrites the former.

This can create a non-explicit (unobvious) tarbomb, which technically does not contain files with absolute paths or referring to parent directories, but still causes overwriting files outside current directory (for example, archive may contain two files with the same path and filename, first of which is a symlink to some location outside current directory, and second of which is a regular file; then extracting such archive on some tar implementations may cause writing to the location pointed to by the symlink).

Key implementations

[edit]

Historically, many systems have implemented tar, and many general file archivers have at least partial support for tar (often using one of the implementations below). The history of tar is a story of incompatibilities, known as the "tar wars". Most tar implementations can also read and create cpio and pax (the latter actually is a tar-format with POSIX-2001-extensions).

Key implementations in order of origin:

  • Solaris tar, based on the original Unix V7 tar and comes as the default on the Solaris operating system
  • GNU tar is the default on most Linux distributions. It is based on the public domain implementation pdtar which started in 1987. Recent versions can use various formats, including ustar, pax, GNU and v7 formats.
  • FreeBSD tar (also BSD tar) has become the default tar on most Berkeley Software Distribution-based operating systems including Mac OS X. The core functionality is available as libarchive for inclusion in other applications. This implementation automatically detects the format of the file and can extract from tar, pax, cpio, zip, rar, ar, xar, rpm and ISO 9660 cdrom images. It also comes with a functionally equivalent cpio command-line interface.
  • Schily tar, better known as star (/??s?tɑ?r/, ESS-tar),[33] is historically significant as some of its extensions were quite popular. First published in April 1997,[34] its developer has stated that he began development in 1982.[35]
  • Python tarfile module supports multiple tar formats, including ustar, pax and gnu; it can read but not create V7 format and the SunOS tar extended format; pax is the default format for creation of archives.[36] Available since 2003.[37]

Additionally, most pax and cpio implementations can read and create multiple types of tar files.

Suffixes for compressed files

[edit]

tar archive files usually have the file suffix .tar (e.g. somefile.tar).

A tar archive file contains uncompressed byte streams of the files which it contains. To achieve archive compression, a variety of compression programs are available, such as gzip, bzip2, xz, lzip, lzma, zstd, or compress, which compress the entire tar archive. Typically, the compressed form of the archive receives a filename by appending the format-specific compressor suffix to the archive file name. For example, a tar archive archive.tar, is named archive.tar.gz, when it is compressed by gzip.

Popular tar programs like the BSD and GNU versions of tar support the command-line options Z (compress), z (gzip), and j (bzip2) to compress or decompress the archive file upon creation or unpacking. Relatively recent additions include --lzma (LZMA), --lzop (lzop), --xz or J (xz), --lzip (lzip), and --zstd.[38] The decompression of these formats is handled automatically if supported filename extensions are used, and compression is handled automatically using the same filename extensions if the option --auto-compress (short form -a) is passed to an applicable version of GNU tar.[16] BSD tar detects an even wider range of compressors (lrzip, lz4), using not the filename but the data within.[39] Unrecognized formats are to be manually compressed or decompressed by piping.

MS-DOS's 8.3 filename limitations resulted in additional conventions for naming compressed tar archives. However, this practice has declined with FAT now offering long filenames.

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 is compressed as one unit.
File suffix equivalents[16]
Compressor Long Short
bzip2 .tar.bz2 .tb2, .tbz, .tbz2, .tz2
gzip .tar.gz .taz, .tgz
lzip .tar.lz
lzma .tar.lzma .tlz
lzop .tar.lzo
xz .tar.xz .txz
compress .tar.Z .tZ, .taZ
zstd .tar.zst .tzst

See also

[edit]

References

[edit]
  1. ^ "libarchive - C library and command-line tools for reading and writing tar, cpio, zip, ISO, and other archive formats @ GitHub". www.libarchive.org.
  2. ^ Sergey Poznyakoff (18 July 2023). "tar-1.35 released [stable]". Retrieved 26 July 2023.
  3. ^ John Gilmore (2025-08-06). "v07i088: Public-domain TAR program". Newsgroupmod.sources. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  4. ^ "posixtar".
  5. ^ "star". Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  6. ^ Gilmore, John; Fenlason, Jay (4 February 2019). "Basic Tar Format". gnu.org. and others. Free Software Foundation. Retrieved 17 April 2019.
  7. ^ a b "tar(5) manual page". FreeBSD.org. FreeBSD. 20 May 2004. Retrieved 2 May 2017.
  8. ^ IEEE Std 1003.1-1988, IEEE Standard for Information Technology - Portable Operating System Interface (POSIX)
  9. ^ IEEE Std 1003.1-2001, IEEE Standard for Information Technology - Portable Operating System Interface (POSIX)
  10. ^ IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 2025-08-06.
  11. ^ "Announcing Windows 10 Insider Preview Build 17063 for PC". Windows Experience Blog. 2025-08-06. Retrieved 2 July 2018.
  12. ^ "Tar and Curl Come to Windows!". 2025-08-06.
  13. ^ "Blocking". ftp.gnu.org. Retrieved 2025-08-06.
  14. ^ Hoo, James. "Open/Extract TAR File with Freeware on Windows/Mac/Linux". e7z Org. Archived from the original on 6 February 2015. Retrieved 3 September 2019.
  15. ^ Kientzle, Tim (1995). Internet File Formats. Coriolis Groups Books. p. 196. ISBN 978-1-883577-56-8. Retrieved 2025-08-06.
  16. ^ a b c "GNU tar 1.32: 8.1 Using Less Space through Compression". GNU. 2025-08-06. Retrieved 2025-08-06.
  17. ^ NEWS, git.savannah.gnu.org - search for "Added support for POSIX.1-2001 and ustar archive formats."
  18. ^ "GNU tar 1.34: 8. Controlling the Archive Format". GNU. Retrieved 2025-08-06.
  19. ^ pax – Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group
  20. ^ "#2116 Tars with pax headers not parsed". 7-Zip / Bugs | SourceForge.
  21. ^ GNU tar 1.35: 6.8 Operating Only on New Files
  22. ^ Differences Between BSD tar and GNU tar and star | Baeldung on Linux
  23. ^ "duplicity: New file format". duplicity.nongnu.org.
  24. ^ gnu_tar/src/create.c at master · gitGNU/gnu_tar · GitHub, line 546
  25. ^ src/bin/pax/tar.c at 8df76133309eacd4092b091ee0504adb842322a5 · openbsd/src · GitHub, line 1066
  26. ^ a b tar(5) – FreeBSD File Formats Manual
  27. ^ "Extended attributes: the good, the not so good, the bad". Les bons comptes. 15 July 2014. Archived from the original on 14 December 2014. Retrieved 3 September 2019. The extended attributes can be very valuable for storing file metadata (e.g. author="John Smith", subject="country landscape"), in the many cases where you do not want or can't store this data in the file internal properties.
  28. ^ "Tarbomb Definition". The Linux Info Project. Retrieved 2025-08-06.
  29. ^ "bsdtar(1)". man.freebsd.org.
  30. ^ Creating TAR with 100 KB missing at the beginning: tail --bytes=+100000 "intact archive.tar" >>"missing beginning.tar". Next header can be found using a hex editor. Recover using dd if="missing beginning.tar" of=recovered.tar ibs=[bytes until next header which starts with file path and name] skip=1. Quotation marks are not needed for file names without spaces.
  31. ^ BillThor (July 28, 2017). "What makes a tar archive seekable?". Super User. Retrieved 15 December 2023.
  32. ^ "GNU tar 1.35: 4.2.4 Combining Archives with --concatenate". www.gnu.org.
  33. ^ Schilling, J?rg. "Star a very fast and Posix 1003.1 compliant tar archiver for UNIX". Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  34. ^ Thomas E. Dickey (January 4, 2015). "TAR versus Portability: Schily tar". Retrieved October 23, 2021.
  35. ^ J?rg Schilling (September 4, 2021). "star - unique standard tape archiver". Retrieved October 23, 2021.[permanent dead link]
  36. ^ tarfile module, python.org
  37. ^ tarfile.py, github.com
  38. ^ Poznyakoff, Sergey (2025-08-06). "tar-1.31 released [stable]". GNU mailing lists. Retrieved 2025-08-06.
  39. ^ tar(1) – FreeBSD General Commands Manual
[edit]
什么自行车最贵 高血糖不能吃什么 同房痛什么原因引起的 水滴鱼长什么样子 12月3日什么星座
自学成才是什么意思 吃苹果有什么好处和功效 什么书比较好 桂圆有什么功效 排除是什么意思
肚子为什么胀气 弼马温是什么意思 升阳是什么意思 反流性食管炎吃什么药最好 摩羯座什么性格
毛囊是什么 精索静脉曲张是什么原因导致的 处女男喜欢什么样的女生 盆腔炎吃什么消炎药 什么方法可以促进睡眠
p代表什么意思hcv7jop5ns6r.cn 请婚假需要什么材料travellingsim.com 为什么要喝酒hcv8jop0ns3r.cn 一什么小船hcv8jop4ns9r.cn 为什么女追男没好下场hcv8jop4ns9r.cn
胎盘是什么hcv8jop1ns6r.cn 消化不好吃什么药imcecn.com 匈奴人是现在的什么人shenchushe.com 无性恋是什么hcv7jop6ns4r.cn 啼笑皆非的意思是什么hcv9jop3ns6r.cn
plv是什么意思hcv7jop9ns0r.cn 王大锤真名叫什么wzqsfys.com 经期可以吃什么水果hcv8jop8ns7r.cn 现在什么手机好用chuanglingweilai.com 别无他求是什么意思hkuteam.com
取什么补什么hcv9jop1ns2r.cn 什么什么泪下hcv9jop0ns0r.cn 熊猫喜欢吃什么食物beikeqingting.com 小孩记忆力差需要补充什么营养hcv7jop9ns9r.cn 耳仓为什么是臭的baiqunet.com
百度