.tar
Archive
TAR(Tape Archive)
TARはUnixのアーカイブフォーマットで、パーミッション、所有権、タイムスタンプを保持しながら複数のファイルとディレクトリを単一の非圧縮ファイルにバンドルします。TARはほぼ常に圧縮ツール(gzip、bzip2、xz)と組み合わせて.tar.gz、.tar.bz2、.tar.xzアーカイブを作成します。
MIMEタイプ
application/x-tar
種類
バイナリ
圧縮
無劣化
メリット
- + Preserves Unix permissions, ownership, symbolic links, and timestamps
- + Streaming-friendly — can be created and extracted via pipes
- + Standard on all Unix/Linux systems with no additional software
デメリット
- − No built-in compression — must be combined with gzip, bzip2, or xz
- − No random access — extracting one file requires reading sequentially
- − Less intuitive for Windows users than ZIP
.TARを使うタイミング
Unix/Linuxのバックアップ、ソースコード配布、Dockerイメージレイヤーに(圧縮と共に)TARを使用してください。
技術的詳細
TARファイルは512バイトブロックのシーケンスです。各ファイルエントリはメタデータを含むヘッダブロックの後にデータブロックが続きます。TAR自体は圧縮を行いません。厳密にはアーカイブ(連結)フォーマットです。
歴史
TARは1979年にUnix Version 7で磁気テープにファイルアーカイブを書き込むために作成されました。POSIX.1-2001標準(paxフォーマット)が長いファイル名と大きなファイル用の拡張ヘッダーでTARを近代化しました。