Provided by: manpages-zh_1.6.4.3-1_all bug

名字

       tar - tar 檔案檔案管理程式的 GNU 版本。

總覽

       tar <操作引數> [選項]

       操作引數:
       [-]A --catenate --concatenate
       [-]c --create
       [-]d --diff --compare
       [-]r --append
       [-]t --list
       [-]u --update
       [-]x --extract --get
       --delete

       常用選項:
       -C, --directory 目錄
       -f, --file 檔案
       -j, --bzip2
       -J, --xz
       -p, --preserve-permissions
       -v, --verbose
       -z, --gzip

       所有選項:
       [ -a, --auto-compress ] [ --add-file 檔案 ] [ --anchored ] [ --atime-preserve ] [ -b, --blocking-factor N
       ]  [  -B,  --read-full-records  ] [ --backup[=備份型別] ] [ --block-compress ] [ -C, --directory 目錄 ] [
       --checkpoint ] [ --delay-directory-restore ] [ --exclude 檔案或目錄 ] [ --exclude-caches ]  [  --exclude-
       caches-all  ]  [  --exclude-caches-under ] [ --exclude-tag 檔案 ] [ --exclude-tag-all 檔案 ] [ --exclude-
       tag-under 檔案 ] [ -f, --file [主機名:]檔案 ] [ -F, --info-script  檔案,  --new-volume-script  檔案  ]  [
       --force-local  ] [ --format 格式 ] [ -g, --listed-incremental 快照 ] [ -G, --incremental ] [ --group 組 ]
       [ -h, --dereference ] [ --help ] [ -i, --ignore-zeros ] [ -I, --use-compress-program 程式 ]  [  --ignore-
       case  ]  [  --ignore-command-error ] [ --ignore-failed-read ] [ --index-file 檔案 ] [ -j, --bzip2 ] [ -J,
       --xz ] [ -k, --keep-old-files ] [ -K, --starting-file 檔案 ] [ --keep-newer-files ] [ -l, --check-links ]
       [ -L, --tape-length N ] [ --lzip ] [ --lzma ] [ --lzop ] [  -m,  --touch,  --modification-time  ]  [  -M,
       --multi-volume  ]  [  --mode 許可權 ] [ --mtime 日期 ] [ -N, --after-date 日期, --newer 日期 ] [ --newer-
       mtime 日期 ] [ --no-anchored ] [ --no-auto-compress ] [ --no-delay-directory-restore ] [ --no-ignore-case
       ] [ --no-ignore-command-error ] [ --no-overwrite-dir ] [ --no-quote-chars ] [ --no-recursion  ]  [  --no-
       same-permissions  ]  [  --no-unquote  ]  [  --no-wildcards  ] [ --no-wildcards-match-slash ] [ --null ] [
       --numeric-owner  ]  [  -o,  --old-archive,  --portability,  --no-same-owner  ]  [  -O,  --to-stdout  ]  [
       --occurrence  次數  ]  [ --one-file-system ] [ --overwrite ] [ --overwrite-dir ] [ --owner 使用者 ] [ -p,
       --same-permissions, --preserve-permissions ] [ -P, --absolute-names  ]  [  --pax-option  關鍵字列表  ]  [
       --posix ] [ --preserve ] [ --quote-chars 字串 ] [ --quote-style 風格 ] [ -R, --block-number ] [ --record-
       size  位元組數 ] [ --recursion ] [ --recursive-unlink ] [ --remove-files ] [ --restrict ] [ --rmt-command
       命令 ] [ --rsh-command 命令 ] [ -s, --same-order, --preserve-order ] [ -S, --sparse ] [ --same-owner ]  [
       --show-defaults  ]  [  --show-omitted-dirs ] [ --show-transformed-names, --show-stored-names ] [ --strip-
       components 目錄層數 ] [ --suffix 字尾 ] [ -T, --files-from 檔案 ] [ --test-label ] [ --to-command 命令  ]
       [ --transform sed表示式 ] [ --totals ] [ -U, --unlink-first ] [ --unquote ] [ --utc ] [ -v, --verbose ] [
       -V,  --label  名稱  ]  [  --version  ]  [ --volno-file 檔案 ] [ -w, --interactive, --confirmation ] [ -W,
       --verify ] [ --wildcards ] [ --wildcards-match-slash  ]  [  -X,  --exclude-from  檔案  ]  [  -z,  --gzip,
       --gunzip, --ungzip ] [ -Z, --compress, --uncompress ] [ -[0-7][lmh] ]

描述

       這是tar的GNU版本的手冊頁。  tar是一個用於儲存或提取tar檔案的程式。 tar檔案可放在磁碟中, 也可以存為普通檔
       案。 tar 的第一個引數必須是操作引數A、c、d、r、t、u、x 中的一個, 引數後面可跟著任意可選選項。  tar的最後
       一個引數是你要處理的檔案或目錄的名字。 如果你指定了一個目錄, 該目錄的所有子目錄都將被加入存檔。

應用舉例

       tar -xvf foo.tar
              提取 foo.tar 檔案並顯示提取過程

       tar -xzf foo.tar.gz
              提取用 gzip 壓縮的檔案 foo.tar.gz

       tar -cjf foo.tar.bz2 bar/
              用 bzip 為目錄 bar 建立一個叫做 foo.tar.bz2存檔

       tar -xjf foo.tar.bz2 -C bar/
              把用 bzip 壓縮的檔案 foo.tar.bz2 提取到 bar 目錄

       tar -xzf foo.tar.gz blah.txt
              把檔案 blah.txt 從 foo.tar.gz 中提取出來

       注意: 當壓縮或提取的時候, 壓縮型別選項常常是不必需的, 因為tar會根據檔案的字尾自動選擇壓縮型別。

引數說明

       下列引數中必須有至少一個被使用:

       -A, --catenate, --concatenate
              將一存檔與已有的存檔合併

       -c, --create
              建立一個新的存檔

       -d, --diff, --compare
              比較存檔與相應的未存檔檔案的不同之處

       -r, --append
              將檔案附加到存檔結尾

       -t, --list
              列出存檔中檔案的目錄

       -u, --update
              僅將較新的檔案附加到存檔中

       -x, --extract, --get
              從存檔提取檔案

       --delete
              把指定檔案從存檔中刪除(不要用於磁帶!)

常用選項

       -C, --directory 目錄
              提取存檔到指定目錄

       -f, --file [主機名:]檔案
              指定存檔或裝置中的檔案 (預設是 "-", 表示 標準輸入/輸出)

       -j, --bzip2
              用 bzip2 處理存檔; 用於 .bz2 檔案

       -J, --xz
              用 xz 處理存檔; 用於 .xz 檔案

       -p, --preserve-permissions
              提取所有保護資訊

       -v, --verbose
              顯示檔案處理過程

       -z, --gzip, --ungzip
              用 gzip 處理存檔; 用於 .gz 檔案

所有選項

       -a, --auto-compress
              根據存檔字尾來選擇壓縮程式

       --add-file 檔案
              新增指定檔案到存檔 (對以下標線開頭的檔案很有用)

       --anchored
              patterns will match the start of file names

       --atime-preserve
              不改變存檔中檔案的訪問時間

       -b, --blocking-factor N
              指定塊大小為 Nx512 位元組(預設N=20)

       -B, --read-full-blocks
              讀取時重組塊 (用於讀取4.2BSD pipes)

       --backup[=備份型別]
              備份檔案而不是刪除它們,  備份型別有simple、numbered等

       --block-compress
              讓磁帶的輸出結果成塊輸出

       -C, --directory 目錄
              提取文件到指定目錄

       --checkpoint
              讀取存檔時顯示目錄名

       --delay-directory-restore
              延遲對已提取目錄的修改時間和許可權的設定, 直到提取結束

       --exclude 檔案或目錄
              排除指定檔案或目錄

       --exclude-caches
              排除帶有 快取目錄 標記的目錄

       --exclude-tag 檔案
              排除包含指定檔案的目錄

       -f, --file [主機名:]檔案
              指定存檔或裝置中的檔案 (預設是 "-", 表示 標準輸入/輸出)

       -F, --info-script 檔案, --new-volume-script 檔案
              在每卷磁帶的結尾執行指令碼 (會應用--multi-volume選項)

       --force-local
              存檔檔案是本地的, 即使它的名稱中含有冒號

       --format FORMAT
              選擇建立存檔的格式
              v7 - Unix V7
              oldgnu - GNU tar <=1.12
              gnu - GNU tar 1.13
              ustar - POSIX.1-1988
              posix - POSIX.1-2001

       -g, --listed-incremental 快照
              建立/列出/提取 新GNU格式的增量備份

       --group 組
              將新增到存檔的檔案的組標識設定為指定組, 而不是原始檔所在的組; 這個選項對提取無效

       -G, --incremental
              建立/列出/提取 舊GNU格式的增量備份

       -h, --dereference
              不存入符號連結; 存入連結指向的檔案

       --help 顯示像本手冊這樣的幫助資訊, 但不像這麼詳細

       -i, --ignore-zeros
              忽略存檔中的 0 位元組塊 (那通常意味著檔案結束)

       -I, --use-compress-program 程式
              透過指定程式訪問存檔 (該程式通常是一個壓縮程式; 它需能接受 -d 引數)

       --ignore-case
              排除檔案時不區分大小寫

       --ignore-command-error
              忽略子程式的退出程式碼

       --ignore-failed-read
              遇到不可讀檔案的非零狀態不退出

       --index-file 檔案
              將處理過程資訊輸出到指定檔案, 而不是輸出到標準輸出

       -j, --bzip2
              用 bzip2 處理存檔, 用於 .bz2 檔案

       -J, --xz
              用 xz 處理存檔, 用於 .xz 檔案

       -k, --keep-old-files
              保留已存在的檔案; 不用存檔中的檔案覆蓋它們

       -K, --starting-file FILE
              從存檔中的指定檔案處開始

       --keep-newer-files
              不覆蓋比存檔新的檔案

       -l, --check-links
              如果檔案系統中檔案的硬連結數和存檔中記錄的不同, 則發出警告

       -L, --tape-length N
              在寫入了N*1024位元組後, 更換磁帶

       -m, --touch, --modification-time
              不提取檔案的修改時間

       -M, --multi-volume
              建立/列出/提取 多卷存檔

       --mode 許可權
              新增檔案時應用指定的許可權 (參看 chmod(1))

       --mtime 日期
              當建立存檔時, 使用指定日期作為存檔成員的修改日期, 而不是使用檔案的實際修改時間

       -N, --after-date 日期, --newer 日期
              只儲存在指定日期後有修改或狀態更新 (許可權, ACLs, 擴充套件屬性, ...)的檔案

       --newer-mtime 日期
              和 --newer 類似, 但是隻儲存指定日期後有修改的檔案

       --no-anchored
              匹配任意‘/’後字元項--exclude一起使用

       --no-auto-compress
              不根據存檔字尾來決定使用哪個壓縮程式

       --no-delay-directory-restore
              在目錄中的所有檔案都被提取完成時, 就設定該目錄的修改時間和許可權; 這是預設設定

       --no-ignore-command-error
              對以非零狀態終止的子程式的顯示警告

       --no-ignore-case--exclude 匹配時區分大小寫

       --no-overwrite-dir
              從存檔中提取檔案時, 保留已存在目錄的元資料。

       --no-quote-chars 字串
              把指定字串中的字元從--quote-chars選項指定的字元中去除

       --no-recursion
              不遞迴進入子目錄

       --no-same-permissions
              提取時應用使用者的umask, 而不是用已記錄的許可權

       --no-unquote
              將所有輸入檔案或成員的名字作為普通文字, 不解釋轉義序列

       --no-wildcards
              不對--exclude使用萬用字元

       --no-wildcards-match-slash
              --exclude的萬用字元不匹配斜槓(/)

       --null --files-from讀取以空值終止的名字, 停用--directory

       --numeric-owner
              總是用數字作為 使用者/組 的名字

       -o, --old-archive, --portability
              相當於--format=v7; 當建立存檔時-o選項表示這個行為 (已棄用的行為)

       -o, --no-same-owner
              提取時不恢復所有權; 當提取時-o選項表示這個行為

       -O, --to-stdout
              將檔案提取到標準輸出

       --occurrence 次數
              只處理指定次數每個已被命名的檔案的在操作中的出現; 用於--delete, --diff, --extract, 或 --list

       --one-file-system
              建立存檔時停留在本地檔案系統

       --overwrite
              提取時覆蓋已存在的檔案和目錄中的元資料

       --overwrite-dir
              提取時覆蓋目錄中的元資料

       --owner 使用者
              將檔案所有者設為指定使用者, 而不是原檔案的所有者; 這個選項對提取無效

       -p, --preserve-permissions, --same-permissions
              提取所有保護資訊

       -P, --absolute-names
              將檔名開頭的“/”符號看作檔名的一部分

       --pax-option 關鍵字列表
              修改tar處理擴充套件頭關鍵字的方式, 只用於POSIX.1-2001存檔

       --posix
              相當於--format=posix

       --preserve
              相當於--preserve-permissions加上--same-order

       --quote-chars 字串
              總是標出指定字串中包含的的字元, 即使已選擇的標識風格不標識它們

       --quote-style 風格
              設定顯示成員和檔名稱的標識風格

       -R, --record-number
              顯示存檔中每條資訊的記錄數字

       --record-size 位元組數
              訪問存檔時每條記錄使用指定的位元組數

       --recursion
              遞迴進入目錄

       --recursive-unlink
              提取目錄之前先把存在的相同名稱的目錄刪除

       --remove-files
              把檔案加入到存檔後刪除這些檔案

       --restrict
              停用一些有潛在害處的選項; 目前這會停用多卷選單中對shell的呼叫

       --rmt-command 命令
              用指定的命令代替預設的/usr/sbin/rmt

       --rsh-command 命令
              用指定的遠端命令代替rsh(1)

       -s, --same-order, --preserve-order
              名稱列表會被排序以匹配存檔

       -S, --sparse
              高效地處理稀疏檔案

       --same-owner
              以相同的所有權建立提取出的檔案

       --show-defaults
              顯示tar使用的預設選項

       --show-omitted-dirs
              顯示提取時tar跳過的目錄

       --show-transformed-names, --show-stored-names
              應用了任何sed轉換之後, 顯示檔案或成員名字

       --strip-components 目錄層數
              在提取前, 把檔案從前往後指定層數的目錄都從提取路徑中去掉, 如果檔案包含在指定層數中, 則不被提取

       --suffix 字尾
              備份檔案時, 使用指定的字尾, 而不是使用預設字尾‘~’

       -T, --files-from 檔案
              從指定檔案中獲得要提取或建立的存檔的名字

       --test-label
              讀取卷標; 如果一個詞被指定了, 則測試它是否匹配這個卷標

       --to-command 命令
              提取期間, 將提取的檔案匯入到指定命令的標準輸入

       --totals
              顯示用--create引數寫入的總位元組數

       --transform sed表示式
              用sed的轉換表示式轉換檔案或成員的名字

       -U, --unlink-first
              提取檔案之前,刪除已存在的與之同名的檔案

       --unquote
              不標識輸入檔案或成員的名字; 這是預設選項

       --utc  以UTC時間顯示檔案的修改日期

       -v, --verbose
              列出檔案的處理情況

       -V, --label 名稱
              用指定卷名建立存檔

       --version
              顯示tar程式的版本資訊

       --volno-file 檔案
              保持追蹤指定檔案中多卷存檔的卷編號; 和--multi-volume一起使用

       -w, --interactive, --confirmation
              每一個動作都要求確認

       -W, --verify
              寫完存檔後對其進行校驗

       --wildcards--exclude用萬用字元

       --wildcards-match-slash
              --exclude的萬用字元匹配斜槓(/)

       -X, --exclude-from 檔案

              排除列在指定檔案中的檔案

       -z, --gzip, --gunzip, --ungzip
              用gzip對存檔進行操作

       -Z, --compress, --uncompress
              用compress對存檔進行操作

       -[0-7][lmh]
              指定驅動器[0-7]和壓縮密度[低中高]

BUGS

       GNU世界的人, 通常不喜歡man手冊, 而是寫文件代替之。 tar的維護者也是如此。 所以, 這個man手冊頁可能會不完
       全,  或者不夠新,  它被包含在Gentoo的portage樹中,  因為man是一個非常好的工具:)。  這個man手冊頁最初取
       自Debian Linux, 從那時起已在這裡被很好地更新。

報告 BUGS

       請透過 http://bugs.gentoo.org/ 報告Bug。 翻譯問題請聯絡譯者或到 https://github.com/lidaobing/manpages-zh/
       提交問題

作者

       Debian Linux http://www.debian.org/
       Mike Frysinger <vapier@gentoo.org>

譯者

       CMPP 中文手冊頁計劃 http://cmpp.linuxforum.net (2001/08/08)
       Saigut <gosaigut@gmail.com> (2013/11/09)

中文版最新更新

       2014/10/04

       本頁面中文版由中文 man 手冊頁計劃提供。
       中文 man 手冊頁計劃:https://github.com/man-pages-zh/manpages-zh

GNU                                                 Mar 2010                                              TAR(1)