Что такое формат файла TAR?
.tar is a file extension for the standard Unix Tape Archive format, also called a "tarball." TAR files are supported on virtually all modern operating systems. TAR itself does not compress - it bundles multiple files and directories into a single archive while preserving Unix file permissions, ownership, symbolic links and timestamps, which is the main reason it remains the preferred container on Linux and Unix systems.
TAR archives are commonly paired with a compression layer. The most popular combination uses gzip, producing .tar.gz files (often written as file_name.tar.gz or abbreviated as .tgz). Other common layered variants include .tar.bz2 and .tar.xz. Most modern archiving tools automatically handle decompression and extraction together.
The format originated in 1979 as part of Version 7 Unix and has since been standardized through POSIX as the ustar (1988) and pax (2001) formats. Internally, a .tar file is a sequence of 512-byte blocks: each member begins with a header block containing the file name, permissions, size and checksum, followed by the file data padded to a 512-byte boundary. Two zero-filled blocks mark the end of the archive. Because it adds no compression overhead, TAR packs and unpacks quickly, and most archive-scanning tools handle .tar files without difficulty.
Безопасность и защита
РИСК: LOWThe TAR format is open and a .tar can't execute on its own. Standard archive caution applies: a tarball from an untrusted source may contain scripts or executables revealed only after extraction, so scan contents before running anything. Two tar-specific notes: a malicious tar can contain '../' or absolute paths (the classic "tar slip" / path-traversal attack that writes files outside the target folder) - extract untrusted tarballs into an empty directory and use a modern extractor that strips leading slashes; and a compressed .tar.gz can be a "decompression bomb" that expands to enormous size, so be wary of suspiciously tiny archives.
Детали формата
в двух словахПрограммы, открывающие файлы TAR
tar -xf file.tar (or tar -xzf file.tar.gz). bsdtar has shipped in Windows since build 17063 (2018). tar -xf file.tar to extract, tar -xzf file.tar.gz for a gzip tarball, tar -cf out.tar dir/ to create. Pre-installed on every Linux/Unix system. Технические подробности
глубокая спецификация| MIME type | application/x-tar (also application/x-gtar) |
| File structure | Sequential 512-byte blocks; each member has a 512-byte header followed by file data padded to a 512-byte boundary |
| Format variants | v7 (1979, original), POSIX ustar (1988), GNU tar, POSIX pax (2001) - differ in long-name, large-file and timestamp handling |
| Compression | None - .tar is uncompressed; compression added by an outer layer (.tar.gz, .tar.bz2, .tar.xz, .tar.zst) |
| Magic bytes | ASCII string "ustar" at byte offset 257 in the 512-byte header; absent in pre-POSIX v7 archives, which are identified by header checksum heuristics |
| Header checksum | Per-member 8-byte ASCII octal checksum covering the 512-byte header block; no whole-archive checksum or signature |
| Numeric field encoding | ASCII octal strings (not binary integers); pax and GNU tar use base-256 encoding for values that exceed the octal range |
| End-of-archive marker | Two consecutive 512-byte zero-filled (null) blocks at the end of the archive |
| Filename length | 100 bytes in v7; 255 bytes with the ustar prefix field; unlimited via pax extended headers or GNU long-name records |
| Per-file size limit | Up to ~8 GB with standard ASCII octal encoding; effectively unlimited with pax format or GNU base-256 encoding |
| Metadata preserved | Unix permissions (mode bits), UID/GID ownership, modification timestamps, symbolic links, hard links, device and special files |
| Encryption | None built-in; encryption applied by an outer wrapper such as gpg |
| Common layered extensions | .tar.gz / .tgz, .tar.bz2 / .tbz2, .tar.xz / .txz, .tar.zst |
| Platform support | Native on Linux, Unix, BSD and macOS; available on Windows 10 and 11 via built-in tar.exe and third-party tools such as 7-Zip |
| Выпущен | 1979 (Version 7 Unix); standardized as POSIX ustar (1988) and pax (2001) |
| Последняя версия | POSIX.1-2001 pax format; GNU tar and bsdtar (libarchive) extensions in active use |
| Открыть стандартное | Да · без роялти |
| Спецификация | pubs.opengroup.org |
Конвертации TAR
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах TAR.
Часто задаваемые вопросы
How do I open a TAR file?
tar -xf file.tar (or just double-click on macOS). On Windows, use the built-in tar -xf file.tar, or the free 7-Zip/PeaZip (right-click > Extract). For a .tar.gz use tar -xzf file.tar.gz.What's the difference between .tar and .tar.gz?
How do I open a TAR file on Windows?
tar command - run tar -xf file.tar in a terminal. For a GUI, install the free 7-Zip or PeaZip and right-click > Extract. For .tar.gz you may extract twice (gz then tar).Does TAR compress files?
Why does my .tar.gz need extracting twice?
tar -xzf, PeaZip, Keka); others remove the gzip layer first (leaving a .tar) and need a second extract.Can I create a TAR file for free?
tar is built into Linux and macOS, and Windows 10/11 include it too. Free GUI tools 7-Zip, PeaZip and Keka also create .tar and .tar.gz.