Difference between revisions of "Tar"
Jump to navigation
Jump to search
↑ https://stackoverflow.com/a/18855909
(30 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | https://en.wikipedia.org/wiki/Tar_(computing) | + | {{lowercase}} |
+ | https://en.wikipedia.org/wiki/Tar_(computing) [http://man7.org/linux/man-pages/man1/tar.1.html man] | ||
+ | == Options == | ||
http://man7.org/linux/man-pages/man1/tar.1.html | http://man7.org/linux/man-pages/man1/tar.1.html | ||
-c (--create) | -c (--create) | ||
− | -remove-files | + | [[-remove-files]] |
− | + | -t or [[--list]] list content of tar file | |
+ | -v (--verbose) | ||
+ | [[tar --help]] | ||
+ | == Examples == | ||
* <code>tar -cf new_file.tar /path/folder/to/tar</code> | * <code>tar -cf new_file.tar /path/folder/to/tar</code> | ||
− | * <code>tar -cvf new_file.tar /path/folder/to/tar</code> | + | * <code>[[tar -cvf]] new_file.tar /path/folder/to/tar</code> |
− | + | ::<code>-c (--create)</code> | |
+ | * <code>[[tar -xvf]]</code> | ||
+ | * <code>DIR="YOUR_DIR" [[bash -c]] '[[tar c]] "$DIR" | xz -T0 -c > "$DIR".tar.xz && ls -lh "$DIR".tar.xz'</code> | ||
+ | == With compression == | ||
* <code>tar -Jcvf new_file.tar.[[xz]] /path/folder/to/tar</code> or <code>tar Jcvf new_file.tar.[[xz]] /path/folder/to/tar</code><ref>https://stackoverflow.com/a/18855909</ref> | * <code>tar -Jcvf new_file.tar.[[xz]] /path/folder/to/tar</code> or <code>tar Jcvf new_file.tar.[[xz]] /path/folder/to/tar</code><ref>https://stackoverflow.com/a/18855909</ref> | ||
− | :<code>-J</code> | + | :<code>-J, --[[xz]]</code> |
+ | :<code>-j, --[[bzip2]]</code> | ||
+ | :<code>--lzip</code> Filter the archive through [[lzip]] | ||
+ | :<code>--lzma</code> Filter the archive through [[lzma]] | ||
+ | :<code>--lzop</code> Filter the archive through [[lzop]] | ||
+ | :<code>--no-auto-compress Do not use archive suffix to determine the compression program</code> | ||
+ | :<code>-z, [[--gzip]], --gunzip, --ungzip</code> Filter the archive through gzip | ||
+ | :<code>-Z, --compress, --uncompress</code> Filter the archive through compress | ||
+ | :<code>--[[zstd]] Filter the archive through zstd</code> | ||
+ | |||
+ | |||
+ | Compress directory using <code>[[xz]]</code> [[multithread]] capabilities | ||
+ | :<code>tar c your_directory | xz [[-T0]] -c > your_file_name.tar.xz</code> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | tar (child): Cannot connect to 2019-08-02T06: resolve failed | ||
+ | tar: 2019-08-02T06\:00+04\:00.tar.xz: Cannot write: [[Broken pipe]] | ||
+ | tar: Child returned status 128 | ||
+ | tar: Error is not recoverable: exiting now | ||
− | == Related | + | == Related terms == |
* <code>[[docker save]]</code> | * <code>[[docker save]]</code> | ||
* <code>[[docker load]]</code> | * <code>[[docker load]]</code> | ||
+ | * <code>[[docker export]]</code> | ||
* <code>[[progress]]</code> | * <code>[[progress]]</code> | ||
+ | * [[UID]] and [[GID]] | ||
+ | * <code>[[file changed as we read it]]</code> | ||
+ | * <code>[[ar]]</code> | ||
+ | * [[HAR]] | ||
== See also == | == See also == | ||
+ | * {{tar}} | ||
* {{xz}} | * {{xz}} | ||
Latest revision as of 17:10, 15 October 2024
https://en.wikipedia.org/wiki/Tar_(computing) man
Options[edit]
http://man7.org/linux/man-pages/man1/tar.1.html
-c (--create) -remove-files -t or --list list content of tar file -v (--verbose) tar --help
Examples[edit]
tar -cf new_file.tar /path/folder/to/tar
tar -cvf new_file.tar /path/folder/to/tar
-c (--create)
With compression[edit]
-J, --xz
-j, --bzip2
--lzip
Filter the archive through lzip--lzma
Filter the archive through lzma--lzop
Filter the archive through lzop--no-auto-compress Do not use archive suffix to determine the compression program
-z, --gzip, --gunzip, --ungzip
Filter the archive through gzip-Z, --compress, --uncompress
Filter the archive through compress--zstd Filter the archive through zstd
Compress directory using xz
multithread capabilities
tar c your_directory | xz -T0 -c > your_file_name.tar.xz
tar (child): Cannot connect to 2019-08-02T06: resolve failed tar: 2019-08-02T06\:00+04\:00.tar.xz: Cannot write: Broken pipe tar: Child returned status 128 tar: Error is not recoverable: exiting now
Related terms[edit]
See also[edit]
tar
,tar -J
,docker-untar
,--list
,ar
,tar -cvf, tar -xvf, tar --help
- Data compression: LZMA,
xz, unxz
,xz -t, xz -q, xz -T0, xz -9, zstd
, Igor Pavlov
Advertising: