tar.1 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
  2. .TH TAR "1" "December 2010" "tar 1.25" "User Commands"
  3. .SH NAME
  4. tar \- The GNU version of the tar archiving utility
  5. .SH SYNOPSIS
  6. .B tar
  7. [\fIOPTION\fR...] [\fIFILE\fR]...
  8. .SH DESCRIPTION
  9. GNU `tar' saves many files together into a single tape or disk archive, and can
  10. restore individual files from the archive.
  11. .SH EXAMPLES
  12. .TP
  13. tar \fB\-cf\fR archive.tar foo bar
  14. # Create archive.tar from files foo and bar.
  15. .TP
  16. tar \fB\-tvf\fR archive.tar
  17. # List all files in archive.tar verbosely.
  18. .TP
  19. tar \fB\-xf\fR archive.tar
  20. # Extract all files from archive.tar.
  21. .IP
  22. Main operation mode:
  23. .TP
  24. \fB\-A\fR, \fB\-\-catenate\fR, \fB\-\-concatenate\fR
  25. append tar files to an archive
  26. .TP
  27. \fB\-c\fR, \fB\-\-create\fR
  28. create a new archive
  29. .TP
  30. \fB\-d\fR, \fB\-\-diff\fR, \fB\-\-compare\fR
  31. find differences between archive and file system
  32. .TP
  33. \fB\-\-delete\fR
  34. delete from the archive (not on mag tapes!)
  35. .TP
  36. \fB\-r\fR, \fB\-\-append\fR
  37. append files to the end of an archive
  38. .TP
  39. \fB\-t\fR, \fB\-\-list\fR
  40. list the contents of an archive
  41. .TP
  42. \fB\-\-test\-label\fR
  43. test the archive volume label and exit
  44. .TP
  45. \fB\-u\fR, \fB\-\-update\fR
  46. only append files newer than copy in archive
  47. .TP
  48. \fB\-x\fR, \fB\-\-extract\fR, \fB\-\-get\fR
  49. extract files from an archive
  50. .IP
  51. Operation modifiers:
  52. .TP
  53. \fB\-\-check\-device\fR
  54. check device numbers when creating incremental
  55. archives (default)
  56. .TP
  57. \fB\-g\fR, \fB\-\-listed\-incremental\fR=\fIFILE\fR
  58. handle new GNU\-format incremental backup
  59. .TP
  60. \fB\-G\fR, \fB\-\-incremental\fR
  61. handle old GNU\-format incremental backup
  62. .TP
  63. \fB\-\-ignore\-failed\-read\fR
  64. do not exit with nonzero on unreadable files
  65. .TP
  66. \fB\-\-level\fR=\fINUMBER\fR
  67. dump level for created listed\-incremental archive
  68. .TP
  69. \fB\-n\fR, \fB\-\-seek\fR
  70. archive is seekable
  71. .TP
  72. \fB\-\-no\-check\-device\fR
  73. do not check device numbers when creating
  74. incremental archives
  75. .TP
  76. \fB\-\-no\-seek\fR
  77. archive is not seekable
  78. .TP
  79. \fB\-\-occurrence\fR[=\fINUMBER\fR]
  80. process only the NUMBERth occurrence of each file
  81. in the archive; this option is valid only in
  82. conjunction with one of the subcommands \fB\-\-delete\fR,
  83. \fB\-\-diff\fR, \fB\-\-extract\fR or \fB\-\-list\fR and when a list of
  84. files is given either on the command line or via
  85. the \fB\-T\fR option; NUMBER defaults to 1
  86. .TP
  87. \fB\-\-sparse\-version\fR=\fIMAJOR[\fR.MINOR]
  88. set version of the sparse format to use (implies
  89. \fB\-\-sparse\fR)
  90. .TP
  91. \fB\-S\fR, \fB\-\-sparse\fR
  92. handle sparse files efficiently
  93. .IP
  94. Overwrite control:
  95. .TP
  96. \fB\-k\fR, \fB\-\-keep\-old\-files\fR
  97. don't replace existing files when extracting
  98. .TP
  99. \fB\-\-keep\-newer\-files\fR
  100. don't replace existing files that are newer than
  101. their archive copies
  102. .TP
  103. \fB\-\-no\-overwrite\-dir\fR
  104. preserve metadata of existing directories
  105. .TP
  106. \fB\-\-overwrite\fR
  107. overwrite existing files when extracting
  108. .TP
  109. \fB\-\-overwrite\-dir\fR
  110. overwrite metadata of existing directories when
  111. extracting (default)
  112. .TP
  113. \fB\-\-recursive\-unlink\fR
  114. empty hierarchies prior to extracting directory
  115. .TP
  116. \fB\-\-remove\-files\fR
  117. remove files after adding them to the archive
  118. .TP
  119. \fB\-U\fR, \fB\-\-unlink\-first\fR
  120. remove each file prior to extracting over it
  121. .TP
  122. \fB\-W\fR, \fB\-\-verify\fR
  123. attempt to verify the archive after writing it
  124. .IP
  125. Select output stream:
  126. .HP
  127. \fB\-\-ignore\-command\-error\fR ignore exit codes of children
  128. .TP
  129. \fB\-\-no\-ignore\-command\-error\fR
  130. treat non\-zero exit codes of children as
  131. error
  132. .TP
  133. \fB\-O\fR, \fB\-\-to\-stdout\fR
  134. extract files to standard output
  135. .TP
  136. \fB\-\-to\-command\fR=\fICOMMAND\fR
  137. pipe extracted files to another program
  138. .IP
  139. Handling of file attributes:
  140. .TP
  141. \fB\-\-atime\-preserve\fR[=\fIMETHOD\fR]
  142. preserve access times on dumped files, either
  143. by restoring the times after reading
  144. (METHOD='replace'; default) or by not setting the
  145. times in the first place (METHOD='system')
  146. .TP
  147. \fB\-\-delay\-directory\-restore\fR
  148. delay setting modification times and
  149. permissions of extracted directories until the end
  150. of extraction
  151. .TP
  152. \fB\-\-group\fR=\fINAME\fR
  153. force NAME as group for added files
  154. .TP
  155. \fB\-\-mode\fR=\fICHANGES\fR
  156. force (symbolic) mode CHANGES for added files
  157. .TP
  158. \fB\-\-mtime\fR=\fIDATE\-OR\-FILE\fR
  159. set mtime for added files from DATE\-OR\-FILE
  160. .TP
  161. \fB\-m\fR, \fB\-\-touch\fR
  162. don't extract file modified time
  163. .TP
  164. \fB\-\-no\-delay\-directory\-restore\fR
  165. cancel the effect of \fB\-\-delay\-directory\-restore\fR
  166. option
  167. .TP
  168. \fB\-\-no\-same\-owner\fR
  169. extract files as yourself (default for ordinary
  170. users)
  171. .TP
  172. \fB\-\-no\-same\-permissions\fR
  173. apply the user's umask when extracting permissions
  174. from the archive (default for ordinary users)
  175. .TP
  176. \fB\-\-numeric\-owner\fR
  177. always use numbers for user/group names
  178. .TP
  179. \fB\-\-owner\fR=\fINAME\fR
  180. force NAME as owner for added files
  181. .TP
  182. \fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR
  183. extract information about file permissions
  184. (default for superuser)
  185. .TP
  186. \fB\-\-preserve\fR
  187. same as both \fB\-p\fR and \fB\-s\fR
  188. .TP
  189. \fB\-\-same\-owner\fR
  190. try extracting files with the same ownership as
  191. exists in the archive (default for superuser)
  192. .TP
  193. \fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR
  194. sort names to extract to match archive
  195. .IP
  196. Device selection and switching:
  197. .TP
  198. \fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR
  199. use archive file or device ARCHIVE
  200. .TP
  201. \fB\-\-force\-local\fR
  202. archive file is local even if it has a colon
  203. .TP
  204. \fB\-F\fR, \fB\-\-info\-script\fR=\fINAME\fR, \fB\-\-new\-volume\-script\fR=\fINAME\fR
  205. run script at end of each tape (implies \fB\-M\fR)
  206. .TP
  207. \fB\-L\fR, \fB\-\-tape\-length\fR=\fINUMBER\fR
  208. change tape after writing NUMBER x 1024 bytes
  209. .TP
  210. \fB\-M\fR, \fB\-\-multi\-volume\fR
  211. create/list/extract multi\-volume archive
  212. .TP
  213. \fB\-\-rmt\-command\fR=\fICOMMAND\fR
  214. use given rmt COMMAND instead of rmt
  215. .TP
  216. \fB\-\-rsh\-command\fR=\fICOMMAND\fR
  217. use remote COMMAND instead of rsh
  218. .TP
  219. \fB\-\-volno\-file\fR=\fIFILE\fR
  220. use/update the volume number in FILE
  221. .IP
  222. Device blocking:
  223. .TP
  224. \fB\-b\fR, \fB\-\-blocking\-factor\fR=\fIBLOCKS\fR
  225. BLOCKS x 512 bytes per record
  226. .TP
  227. \fB\-B\fR, \fB\-\-read\-full\-records\fR
  228. reblock as we read (for 4.2BSD pipes)
  229. .TP
  230. \fB\-i\fR, \fB\-\-ignore\-zeros\fR
  231. ignore zeroed blocks in archive (means EOF)
  232. .TP
  233. \fB\-\-record\-size\fR=\fINUMBER\fR
  234. NUMBER of bytes per record, multiple of 512
  235. .IP
  236. Archive format selection:
  237. .TP
  238. \fB\-H\fR, \fB\-\-format\fR=\fIFORMAT\fR
  239. create archive of the given format
  240. .IP
  241. FORMAT is one of the following:
  242. .TP
  243. gnu
  244. GNU tar 1.13.x format
  245. .TP
  246. oldgnu
  247. GNU format as per tar <= 1.12
  248. .TP
  249. pax
  250. POSIX 1003.1\-2001 (pax) format
  251. .TP
  252. posix
  253. same as pax
  254. .TP
  255. ustar
  256. POSIX 1003.1\-1988 (ustar) format
  257. .TP
  258. v7
  259. old V7 tar format
  260. .TP
  261. \fB\-\-old\-archive\fR, \fB\-\-portability\fR
  262. same as \fB\-\-format\fR=\fIv7\fR
  263. .TP
  264. \fB\-\-pax\-option\fR=\fIkeyword[[\fR:]=value][,keyword[[:]=value]]...
  265. control pax keywords
  266. .TP
  267. \fB\-\-posix\fR
  268. same as \fB\-\-format\fR=\fIposix\fR
  269. .TP
  270. \fB\-V\fR, \fB\-\-label\fR=\fITEXT\fR
  271. create archive with volume name TEXT; at
  272. list/extract time, use TEXT as a globbing pattern
  273. for volume name
  274. .IP
  275. Compression options:
  276. .TP
  277. \fB\-a\fR, \fB\-\-auto\-compress\fR
  278. use archive suffix to determine the compression
  279. program
  280. .TP
  281. \fB\-I\fR, \fB\-\-use\-compress\-program\fR=\fIPROG\fR
  282. filter through PROG (must accept \fB\-d\fR)
  283. .TP
  284. \fB\-j\fR, \fB\-\-bzip2\fR
  285. filter the archive through bzip2
  286. .TP
  287. \fB\-J\fR, \fB\-\-xz\fR
  288. filter the archive through xz
  289. .TP
  290. \fB\-\-lzip\fR
  291. filter the archive through lzip
  292. .TP
  293. \fB\-\-lzma\fR
  294. filter the archive through lzma
  295. .HP
  296. \fB\-\-lzop\fR
  297. .TP
  298. \fB\-\-no\-auto\-compress\fR
  299. do not use archive suffix to determine the
  300. compression program
  301. .TP
  302. \fB\-z\fR, \fB\-\-gzip\fR, \fB\-\-gunzip\fR, \fB\-\-ungzip\fR
  303. filter the archive through gzip
  304. .TP
  305. \fB\-Z\fR, \fB\-\-compress\fR, \fB\-\-uncompress\fR
  306. filter the archive through compress
  307. .IP
  308. Local file selection:
  309. .TP
  310. \fB\-\-add\-file\fR=\fIFILE\fR
  311. add given FILE to the archive (useful if its name
  312. starts with a dash)
  313. .TP
  314. \fB\-\-backup\fR[=\fICONTROL\fR]
  315. backup before removal, choose version CONTROL
  316. .TP
  317. \fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR
  318. change to directory DIR
  319. .TP
  320. \fB\-\-exclude\fR=\fIPATTERN\fR
  321. exclude files, given as a PATTERN
  322. .TP
  323. \fB\-\-exclude\-backups\fR
  324. exclude backup and lock files
  325. .TP
  326. \fB\-\-exclude\-caches\fR
  327. exclude contents of directories containing
  328. CACHEDIR.TAG, except for the tag file itself
  329. .TP
  330. \fB\-\-exclude\-caches\-all\fR
  331. exclude directories containing CACHEDIR.TAG
  332. .TP
  333. \fB\-\-exclude\-caches\-under\fR exclude everything under directories containing
  334. CACHEDIR.TAG
  335. .TP
  336. \fB\-\-exclude\-tag\fR=\fIFILE\fR
  337. exclude contents of directories containing FILE,
  338. except for FILE itself
  339. .HP
  340. \fB\-\-exclude\-tag\-all\fR=\fIFILE\fR exclude directories containing FILE
  341. .TP
  342. \fB\-\-exclude\-tag\-under\fR=\fIFILE\fR
  343. exclude everything under directories
  344. containing FILE
  345. .TP
  346. \fB\-\-exclude\-vcs\fR
  347. exclude version control system directories
  348. .TP
  349. \fB\-h\fR, \fB\-\-dereference\fR
  350. follow symlinks; archive and dump the files they
  351. point to
  352. .TP
  353. \fB\-\-hard\-dereference\fR
  354. follow hard links; archive and dump the files they
  355. refer to
  356. .TP
  357. \fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\-NAME\fR
  358. begin at member MEMBER\-NAME in the archive
  359. .TP
  360. \fB\-\-newer\-mtime\fR=\fIDATE\fR
  361. compare date and time when data changed only
  362. .TP
  363. \fB\-\-no\-null\fR
  364. disable the effect of the previous \fB\-\-null\fR option
  365. .TP
  366. \fB\-\-no\-recursion\fR
  367. avoid descending automatically in directories
  368. .TP
  369. \fB\-\-no\-unquote\fR
  370. do not unquote filenames read with \fB\-T\fR
  371. .HP
  372. \fB\-\-null\fR \fB\-T\fR reads null\-terminated names, disable \fB\-C\fR
  373. .TP
  374. \fB\-N\fR, \fB\-\-newer\fR=\fIDATE\-OR\-FILE\fR, \fB\-\-after\-date\fR=\fIDATE\-OR\-FILE\fR
  375. only store files newer than DATE\-OR\-FILE
  376. .TP
  377. \fB\-\-one\-file\-system\fR
  378. stay in local file system when creating archive
  379. .TP
  380. \fB\-P\fR, \fB\-\-absolute\-names\fR
  381. don't strip leading `/'s from file names
  382. .TP
  383. \fB\-\-recursion\fR
  384. recurse into directories (default)
  385. .TP
  386. \fB\-\-suffix\fR=\fISTRING\fR
  387. backup before removal, override usual suffix ('~'
  388. unless overridden by environment variable
  389. SIMPLE_BACKUP_SUFFIX)
  390. .TP
  391. \fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR
  392. get names to extract or create from FILE
  393. .TP
  394. \fB\-\-unquote\fR
  395. unquote filenames read with \fB\-T\fR (default)
  396. .TP
  397. \fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR
  398. exclude patterns listed in FILE
  399. .IP
  400. File name transformations:
  401. .TP
  402. \fB\-\-strip\-components\fR=\fINUMBER\fR
  403. strip NUMBER leading components from file
  404. names on extraction
  405. .TP
  406. \fB\-\-transform\fR=\fIEXPRESSION\fR, \fB\-\-xform\fR=\fIEXPRESSION\fR
  407. use sed replace EXPRESSION to transform file
  408. names
  409. .IP
  410. File name matching options (affect both exclude and include patterns):
  411. .TP
  412. \fB\-\-anchored\fR
  413. patterns match file name start
  414. .TP
  415. \fB\-\-ignore\-case\fR
  416. ignore case
  417. .TP
  418. \fB\-\-no\-anchored\fR
  419. patterns match after any `/' (default for
  420. exclusion)
  421. .TP
  422. \fB\-\-no\-ignore\-case\fR
  423. case sensitive matching (default)
  424. .TP
  425. \fB\-\-no\-wildcards\fR
  426. verbatim string matching
  427. .TP
  428. \fB\-\-no\-wildcards\-match\-slash\fR
  429. wildcards do not match `/'
  430. .TP
  431. \fB\-\-wildcards\fR
  432. use wildcards (default)
  433. .TP
  434. \fB\-\-wildcards\-match\-slash\fR
  435. wildcards match `/' (default for exclusion)
  436. .IP
  437. Informative output:
  438. .TP
  439. \fB\-\-checkpoint\fR[=\fINUMBER\fR]
  440. display progress messages every NUMBERth record
  441. (default 10)
  442. .TP
  443. \fB\-\-checkpoint\-action\fR=\fIACTION\fR
  444. execute ACTION on each checkpoint
  445. .TP
  446. \fB\-\-full\-time\fR
  447. print file time to its full resolution
  448. .TP
  449. \fB\-\-index\-file\fR=\fIFILE\fR
  450. send verbose output to FILE
  451. .TP
  452. \fB\-l\fR, \fB\-\-check\-links\fR
  453. print a message if not all links are dumped
  454. .TP
  455. \fB\-\-no\-quote\-chars\fR=\fISTRING\fR
  456. disable quoting for characters from STRING
  457. .TP
  458. \fB\-\-quote\-chars\fR=\fISTRING\fR
  459. additionally quote characters from STRING
  460. .TP
  461. \fB\-\-quoting\-style\fR=\fISTYLE\fR
  462. set name quoting style; see below for valid STYLE
  463. values
  464. .TP
  465. \fB\-R\fR, \fB\-\-block\-number\fR
  466. show block number within archive with each message
  467. .TP
  468. \fB\-\-show\-defaults\fR
  469. show tar defaults
  470. .TP
  471. \fB\-\-show\-omitted\-dirs\fR
  472. when listing or extracting, list each directory
  473. that does not match search criteria
  474. .TP
  475. \fB\-\-show\-transformed\-names\fR, \fB\-\-show\-stored\-names\fR
  476. show file or archive names after transformation
  477. .TP
  478. \fB\-\-totals\fR[=\fISIGNAL\fR]
  479. print total bytes after processing the archive;
  480. with an argument \- print total bytes when this
  481. SIGNAL is delivered; Allowed signals are: SIGHUP,
  482. SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; the names
  483. without SIG prefix are also accepted
  484. .TP
  485. \fB\-\-utc\fR
  486. print file modification times in UTC
  487. .TP
  488. \fB\-v\fR, \fB\-\-verbose\fR
  489. verbosely list files processed
  490. .TP
  491. \fB\-\-warning\fR=\fIKEYWORD\fR
  492. warning control
  493. .TP
  494. \fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR
  495. ask for confirmation for every action
  496. .IP
  497. Compatibility options:
  498. .TP
  499. \fB\-o\fR
  500. when creating, same as \fB\-\-old\-archive\fR; when
  501. extracting, same as \fB\-\-no\-same\-owner\fR
  502. .IP
  503. Other options:
  504. .TP
  505. \-?, \fB\-\-help\fR
  506. give this help list
  507. .TP
  508. \fB\-\-restrict\fR
  509. disable use of some potentially harmful options
  510. .TP
  511. \fB\-\-usage\fR
  512. give a short usage message
  513. .TP
  514. \fB\-\-version\fR
  515. print program version
  516. .PP
  517. Mandatory or optional arguments to long options are also mandatory or optional
  518. for any corresponding short options.
  519. .PP
  520. The backup suffix is `~', unless set with \fB\-\-suffix\fR or SIMPLE_BACKUP_SUFFIX.
  521. The version control may be set with \fB\-\-backup\fR or VERSION_CONTROL, values are:
  522. .TP
  523. none, off
  524. never make backups
  525. .TP
  526. t, numbered
  527. make numbered backups
  528. .TP
  529. nil, existing
  530. numbered if numbered backups exist, simple otherwise
  531. .TP
  532. never, simple
  533. always make simple backups
  534. .PP
  535. Valid arguments for the \fB\-\-quoting\-style\fR option are:
  536. .IP
  537. literal
  538. shell
  539. shell\-always
  540. c
  541. c\-maybe
  542. escape
  543. locale
  544. clocale
  545. .PP
  546. *This* tar defaults to:
  547. \fB\-\-format\fR=\fIgnu\fR \fB\-f\-\fR \fB\-b20\fR \fB\-\-quoting\-style\fR=\fIescape\fR \fB\-\-rmt\-command=\fR/bin/rmt
  548. .SH AUTHOR
  549. Written by John Gilmore and Jay Fenlason.
  550. .SH "REPORTING BUGS"
  551. Report bugs to <bug\-tar@gnu.org>.
  552. .SH COPYRIGHT
  553. Copyright \(co 2010 Free Software Foundation, Inc.
  554. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
  555. .br
  556. This is free software: you are free to change and redistribute it.
  557. There is NO WARRANTY, to the extent permitted by law.
  558. .SH "SEE ALSO"
  559. The full documentation for
  560. .B tar
  561. is maintained as a Texinfo manual. If the
  562. .B info
  563. and
  564. .B tar
  565. programs are properly installed at your site, the command
  566. .IP
  567. .B info tar
  568. .PP
  569. should give you access to the complete manual.