Tar: Difference between revisions
Jump to navigation
Jump to search
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
tar --version | |||
==Compress== | ==Compress== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 20: | Line 22: | ||
-t: List the contents of the archive | -t: List the contents of the archive | ||
-f: Specifies the name of the archive | -f: Specifies the name of the archive | ||
==Cheatsheet== | |||
{|class="wikitable" | |||
|- | |||
!scope="col"| Type !!scope="col"| Short !!scope="col"| Compress !!scope="col"| Decompress !!scope="col"| Algorithm !!scope="col"| ⚪ | |||
|- | |||
| '''tar.gz''' || '''-z''' || <code>time tar -czvf nginx_20240630-T1519-ZP0800.tar.gz nginx</code> || <code>time tar -xzvf nginx_20240630-T1519-ZP0800.tar.gz</code> || DEFLATE=LZ77+Huffman || 🟢 | |||
|- | |||
| '''tar.xz''' || '''-J''' || <code>time tar -cJvf nginx_20240630-T1519-ZP0800.tar.xz nginx</code> || <code>time tar -xJvf nginx_20240630-T1519-ZP0800.tar.xz</code> || LZMA2 || 🟠 | |||
|- | |||
| '''tar.bz2''' || '''-j''' || <code>time tar -cjvf nginx_20240630-T1519-ZP0800.tar.bz2 nginx</code> || <code>time tar -xjvf nginx_20240630-T1519-ZP0800.tar.bz2</code>|| BZIP2 || 🟡 | |||
|} | |||
==DateTime Format== | ==DateTime Format== | ||
Line 46: | Line 60: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
* [[7Zip]] | |||
* [[Zip]] | |||
* [https://en.wikipedia.org/wiki/Tar Tar] | * [https://en.wikipedia.org/wiki/Tar Tar] | ||
Line 65: | Line 81: | ||
* [[Crontab]] | * [[Crontab]] | ||
* [[PyEnv]] | * [[PyEnv]] | ||
* [[Drone]] | |||
* [[TMux]] | * [[TMux]] | ||
| valign="top" | | | valign="top" | | ||
* [[Chorke Academia Backup]] | |||
* [https://stackoverflow.com/questions/10555483/ MediaWiki Escape </code>|</code>] | |||
* [[Disk Performance]] | |||
* [[Google Cloud CLI]] | |||
* [[Free Up RAM]] | |||
* [[AWS CLI]] | |||
| valign="top" | | | valign="top" | | ||
|} | |} |
Latest revision as of 23:31, 5 July 2024
tar --version
Compress
cd /etc/nginx
tar -czvf chorke-nginx_academia-production-20240628-T2023-ZP0800.tar.gz sites-enabled
tar --exclude=default -czvf chorke-nginx_academia-production-20240628-T2023-ZP0800.tar.gz sites-enabled
Decompress
tar -tzvf chorke-nginx_academia-production-20240628-T2023-ZP0800.tar.gz
tar -xzvf chorke-nginx_academia-production-20240628-T2023-ZP0800.tar.gz
tar -xzvf chorke-nginx_academia-production-20240628-T2023-ZP0800.tar.gz -C chorke-nginx-academia-production
Explanation
-c: Create a new archive -x: Extract the archive -z: Compress the archive with gzip -v: Verbosely list files processed -t: List the contents of the archive -f: Specifies the name of the archive
Cheatsheet
Type | Short | Compress | Decompress | Algorithm | ⚪ |
---|---|---|---|---|---|
tar.gz | -z | time tar -czvf nginx_20240630-T1519-ZP0800.tar.gz nginx |
time tar -xzvf nginx_20240630-T1519-ZP0800.tar.gz |
DEFLATE=LZ77+Huffman | 🟢 |
tar.xz | -J | time tar -cJvf nginx_20240630-T1519-ZP0800.tar.xz nginx |
time tar -xJvf nginx_20240630-T1519-ZP0800.tar.xz |
LZMA2 | 🟠 |
tar.bz2 | -j | time tar -cjvf nginx_20240630-T1519-ZP0800.tar.bz2 nginx |
time tar -xjvf nginx_20240630-T1519-ZP0800.tar.bz2 |
BZIP2 | 🟡 |
DateTime Format
echo "$(date +'%Y%m%d-T%H%M')-Z$(date +'%z'|tr '+-' 'PM')"
:'
20240628-T2023-ZP0800
├─ 20240628
│ ├─ 2024 « %Y
│ ├─ 06 « m%
│ └─ 28 « %d
├─ -T2023
│ ├─ - « -
│ ├─ T « Time
│ ├─ 20 « %H
│ └─ 23 « %M
└─ -ZP0800
├─ - « -
├─ Z « Zone
├─ P « {P: Plus (+), M:Minus (-)}
└─ 0800 « Time Offset
'
References
| ||