1. [安装]
  2. : centos7 默认安装
  1. [安装]
  2. : centos7 自带 -> tar xz

解压缩命令

  1. [解压缩命令 .tar.xz]
  2. : xz -d xxx.tar.xz # 解压
  3. : xz -z xxx.tar # 压缩
  4. [归档解档]
  5. # 归档目录
  6. : tar cvf xxx.tar xxx/
  7. # 解档
  8. : tar xvf xxx.tar
  9. [解档到指定目录]
  10. : mkdir xxx/ # 创建目录
  11. # 解档
  12. : tar xvf xxx.tar -C xxx/

tar —help & centos7

  1. Usage: tar [OPTION...] [FILE]...
  2. GNU `tar' saves many files together into a single tape or disk archive, and can
  3. restore individual files from the archive.
  4. Examples:
  5. tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
  6. tar -tvf archive.tar # List all files in archive.tar verbosely.
  7. tar -xf archive.tar # Extract all files from archive.tar.
  8. Main operation mode:
  9. -A, --catenate, --concatenate append tar files to an archive
  10. -d, --diff, --compare find differences between archive and file system
  11. --delete delete from the archive (not on mag tapes!)
  12. -r, --append append files to the end of an archive
  13. -t, --list list the contents of an archive
  14. --test-label test the archive volume label and exit
  15. -u, --update only append files newer than copy in archive
  16. # 创建归档文件
  17. -c, --create create a new archive
  18. # 归档中提取文件
  19. -x, --extract, --get extract files from an archive
  20. Operation modifiers:
  21. --check-device check device numbers when creating incremental
  22. archives (default)
  23. -g, --listed-incremental=FILE handle new GNU-format incremental backup
  24. -G, --incremental handle old GNU-format incremental backup
  25. --ignore-failed-read do not exit with nonzero on unreadable files
  26. --level=NUMBER dump level for created listed-incremental archive
  27. -n, --seek archive is seekable
  28. --no-check-device do not check device numbers when creating
  29. incremental archives
  30. --no-seek archive is not seekable
  31. --occurrence[=NUMBER] process only the NUMBERth occurrence of each file
  32. in the archive; this option is valid only in
  33. conjunction with one of the subcommands --delete,
  34. --diff, --extract or --list and when a list of
  35. files is given either on the command line or via
  36. the -T option; NUMBER defaults to 1
  37. --sparse-version=MAJOR[.MINOR]
  38. set version of the sparse format to use (implies
  39. --sparse)
  40. -S, --sparse handle sparse files efficiently
  41. Overwrite control:
  42. -k, --keep-old-files don't replace existing files when extracting,
  43. treat them as errors
  44. --keep-directory-symlink preserve existing symlinks to directories when
  45. extracting
  46. --keep-newer-files don't replace existing files that are newer than
  47. their archive copies
  48. --no-overwrite-dir preserve metadata of existing directories
  49. --overwrite overwrite existing files when extracting
  50. --overwrite-dir overwrite metadata of existing directories when
  51. extracting (default)
  52. --recursive-unlink empty hierarchies prior to extracting directory
  53. --remove-files remove files after adding them to the archive
  54. --skip-old-files don't replace existing files when extracting,
  55. silently skip over them
  56. -U, --unlink-first remove each file prior to extracting over it
  57. -W, --verify attempt to verify the archive after writing it
  58. Select output stream:
  59. --ignore-command-error ignore exit codes of children
  60. --no-ignore-command-error treat non-zero exit codes of children as
  61. error
  62. -O, --to-stdout extract files to standard output
  63. --to-command=COMMAND pipe extracted files to another program
  64. Handling of file attributes:
  65. --atime-preserve[=METHOD] preserve access times on dumped files, either
  66. by restoring the times after reading
  67. (METHOD='replace'; default) or by not setting the
  68. times in the first place (METHOD='system')
  69. --delay-directory-restore delay setting modification times and
  70. permissions of extracted directories until the end
  71. of extraction
  72. --group=NAME force NAME as group for added files
  73. --mode=CHANGES force (symbolic) mode CHANGES for added files
  74. --mtime=DATE-OR-FILE set mtime for added files from DATE-OR-FILE
  75. -m, --touch don't extract file modified time
  76. --no-delay-directory-restore
  77. cancel the effect of --delay-directory-restore
  78. option
  79. --no-same-owner extract files as yourself (default for ordinary
  80. users)
  81. --no-same-permissions apply the user's umask when extracting permissions
  82. from the archive (default for ordinary users)
  83. --numeric-owner always use numbers for user/group names
  84. --owner=NAME force NAME as owner for added files
  85. -p, --preserve-permissions, --same-permissions
  86. extract information about file permissions
  87. (default for superuser)
  88. --preserve same as both -p and -s
  89. --same-owner try extracting files with the same ownership as
  90. exists in the archive (default for superuser)
  91. -s, --preserve-order, --same-order
  92. member arguments are listed in the same order as
  93. the files in the archive
  94. Handling of extended file attributes:
  95. --acls Enable the POSIX ACLs support
  96. --no-acls Disable the POSIX ACLs support
  97. --no-selinux Disable the SELinux context support
  98. --no-xattrs Disable extended attributes support
  99. --selinux Enable the SELinux context support
  100. --xattrs Enable extended attributes support
  101. --xattrs-exclude=MASK specify the exclude pattern for xattr keys
  102. --xattrs-include=MASK specify the include pattern for xattr keys
  103. Device selection and switching:
  104. #
  105. -f, --file=ARCHIVE use archive file or device ARCHIVE
  106. --force-local archive file is local even if it has a colon
  107. -F, --info-script=NAME, --new-volume-script=NAME
  108. run script at end of each tape (implies -M)
  109. -L, --tape-length=NUMBER change tape after writing NUMBER x 1024 bytes
  110. -M, --multi-volume create/list/extract multi-volume archive
  111. --rmt-command=COMMAND use given rmt COMMAND instead of rmt
  112. --rsh-command=COMMAND use remote COMMAND instead of rsh
  113. --volno-file=FILE use/update the volume number in FILE
  114. Device blocking:
  115. -b, --blocking-factor=BLOCKS BLOCKS x 512 bytes per record
  116. -B, --read-full-records reblock as we read (for 4.2BSD pipes)
  117. -i, --ignore-zeros ignore zeroed blocks in archive (means EOF)
  118. --record-size=NUMBER NUMBER of bytes per record, multiple of 512
  119. Archive format selection:
  120. -H, --format=FORMAT create archive of the given format
  121. FORMAT is one of the following:
  122. gnu GNU tar 1.13.x format
  123. oldgnu GNU format as per tar <= 1.12
  124. pax POSIX 1003.1-2001 (pax) format
  125. posix same as pax
  126. ustar POSIX 1003.1-1988 (ustar) format
  127. v7 old V7 tar format
  128. --old-archive, --portability
  129. same as --format=v7
  130. --pax-option=keyword[[:]=value][,keyword[[:]=value]]...
  131. control pax keywords
  132. --posix same as --format=posix
  133. -V, --label=TEXT create archive with volume name TEXT; at
  134. list/extract time, use TEXT as a globbing pattern
  135. for volume name
  136. Compression options:
  137. -a, --auto-compress use archive suffix to determine the compression
  138. program
  139. -I, --use-compress-program=PROG
  140. filter through PROG (must accept -d)
  141. -j, --bzip2 filter the archive through bzip2
  142. -J, --xz filter the archive through xz
  143. --lzip filter the archive through lzip
  144. --lzma filter the archive through lzma
  145. --lzop
  146. --no-auto-compress do not use archive suffix to determine the
  147. compression program
  148. -z, --gzip, --gunzip, --ungzip filter the archive through gzip
  149. -Z, --compress, --uncompress filter the archive through compress
  150. Local file selection:
  151. --add-file=FILE add given FILE to the archive (useful if its name
  152. starts with a dash)
  153. --backup[=CONTROL] backup before removal, choose version CONTROL
  154. # 指定目录
  155. -C, --directory=DIR change to directory DIR
  156. --exclude=PATTERN exclude files, given as a PATTERN
  157. --exclude-backups exclude backup and lock files
  158. --exclude-caches exclude contents of directories containing
  159. CACHEDIR.TAG, except for the tag file itself
  160. --exclude-caches-all exclude directories containing CACHEDIR.TAG
  161. --exclude-caches-under exclude everything under directories containing
  162. CACHEDIR.TAG
  163. --exclude-tag=FILE exclude contents of directories containing FILE,
  164. except for FILE itself
  165. --exclude-tag-all=FILE exclude directories containing FILE
  166. --exclude-tag-under=FILE exclude everything under directories
  167. containing FILE
  168. --exclude-vcs exclude version control system directories
  169. -h, --dereference follow symlinks; archive and dump the files they
  170. point to
  171. --hard-dereference follow hard links; archive and dump the files they
  172. refer to
  173. -K, --starting-file=MEMBER-NAME
  174. begin at member MEMBER-NAME when reading the
  175. archive
  176. --newer-mtime=DATE compare date and time when data changed only
  177. --no-null disable the effect of the previous --null option
  178. --no-recursion avoid descending automatically in directories
  179. --no-unquote do not unquote filenames read with -T
  180. --null -T reads null-terminated names, disable -C
  181. -N, --newer=DATE-OR-FILE, --after-date=DATE-OR-FILE
  182. only store files newer than DATE-OR-FILE
  183. --one-file-system stay in local file system when creating archive
  184. -P, --absolute-names don't strip leading `/'s from file names
  185. --recursion recurse into directories (default)
  186. --suffix=STRING backup before removal, override usual suffix ('~'
  187. unless overridden by environment variable
  188. SIMPLE_BACKUP_SUFFIX)
  189. -T, --files-from=FILE get names to extract or create from FILE
  190. --unquote unquote filenames read with -T (default)
  191. -X, --exclude-from=FILE exclude patterns listed in FILE
  192. File name transformations:
  193. --strip-components=NUMBER strip NUMBER leading components from file
  194. names on extraction
  195. --transform=EXPRESSION, --xform=EXPRESSION
  196. use sed replace EXPRESSION to transform file
  197. names
  198. File name matching options (affect both exclude and include patterns):
  199. --anchored patterns match file name start
  200. --ignore-case ignore case
  201. --no-anchored patterns match after any `/' (default for
  202. exclusion)
  203. --no-ignore-case case sensitive matching (default)
  204. --no-wildcards verbatim string matching
  205. --no-wildcards-match-slash wildcards do not match `/'
  206. --wildcards use wildcards (default)
  207. --wildcards-match-slash wildcards match `/' (default for exclusion)
  208. Informative output:
  209. --checkpoint[=NUMBER] display progress messages every NUMBERth record
  210. (default 10)
  211. --checkpoint-action=ACTION execute ACTION on each checkpoint
  212. --full-time print file time to its full resolution
  213. --index-file=FILE send verbose output to FILE
  214. -l, --check-links print a message if not all links are dumped
  215. --no-quote-chars=STRING disable quoting for characters from STRING
  216. --quote-chars=STRING additionally quote characters from STRING
  217. --quoting-style=STYLE set name quoting style; see below for valid STYLE
  218. values
  219. -R, --block-number show block number within archive with each message
  220. --show-defaults show tar defaults
  221. --show-omitted-dirs when listing or extracting, list each directory
  222. that does not match search criteria
  223. --show-transformed-names, --show-stored-names
  224. show file or archive names after transformation
  225. --totals[=SIGNAL] print total bytes after processing the archive;
  226. with an argument - print total bytes when this
  227. SIGNAL is delivered; Allowed signals are: SIGHUP,
  228. SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; the names
  229. without SIG prefix are also accepted
  230. --utc print file modification times in UTC
  231. #
  232. -v, --verbose verbosely list files processed
  233. --warning=KEYWORD warning control
  234. -w, --interactive, --confirmation
  235. ask for confirmation for every action
  236. Compatibility options:
  237. -o when creating, same as --old-archive; when
  238. extracting, same as --no-same-owner
  239. Other options:
  240. -?, --help give this help list
  241. --restrict disable use of some potentially harmful options
  242. --usage give a short usage message
  243. --version print program version
  244. Mandatory or optional arguments to long options are also mandatory or optional
  245. for any corresponding short options.
  246. The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
  247. The version control may be set with --backup or VERSION_CONTROL, values are:
  248. none, off never make backups
  249. t, numbered make numbered backups
  250. nil, existing numbered if numbered backups exist, simple otherwise
  251. never, simple always make simple backups
  252. Valid arguments for the --quoting-style option are:
  253. literal
  254. shell
  255. shell-always
  256. c
  257. c-maybe
  258. escape
  259. locale
  260. clocale
  261. *This* tar defaults to:
  262. --format=gnu -f- -b20 --quoting-style=escape --rmt-command=/etc/rmt
  263. --rsh-command=/usr/bin/ssh
  264. Report bugs to <bug-tar@gnu.org>.

xz —help & centos7

  1. Usage: xz [OPTION]... [FILE]...
  2. Compress or decompress FILEs in the .xz format.
  3. # 压缩
  4. -z, --compress force compression
  5. # 解压
  6. -d, --decompress, --uncompress
  7. force decompression
  8. -t, --test test compressed file integrity
  9. -l, --list list information about .xz files
  10. -k, --keep keep (don't delete) input files
  11. -f, --force force overwrite of output file and (de)compress links
  12. -c, --stdout, --to-stdout
  13. write to standard output and don't delete input files
  14. -0 ... -9 compression preset; default is 6; take compressor *and*
  15. decompressor memory usage into account before using 7-9!
  16. -e, --extreme try to improve compression ratio by using more CPU time;
  17. does not affect decompressor memory requirements
  18. -T, --threads=NUM use at most NUM threads; the default is 1; set to 0
  19. to use as many threads as there are processor cores
  20. -q, --quiet suppress warnings; specify twice to suppress errors too
  21. -v, --verbose be verbose; specify twice for even more verbose
  22. -h, --help display this short help and exit
  23. -H, --long-help display the long help (lists also the advanced options)
  24. -V, --version display the version number and exit
  25. With no FILE, or when FILE is -, read standard input.
  26. Report bugs to <lasse.collin@tukaani.org> (in English or Finnish).
  27. XZ Utils home page: <http://tukaani.org/xz/>