Tar
Jump to navigation
Jump to search
tar --version
which tar
|
Compress
|
Compress |
|---|
cd /etc/nginx
tar -czvf chorke-nginx_academia-production-D20240628-T2023-ZP0800.tar.gz sites-enabled
tar --exclude=default -czvf chorke-nginx_academia-production-D20240628-T2023-ZP0800.tar.gz sites-enabled
|
Decompress
|
Decompress |
|---|
tar -tzvf chorke-nginx_academia-production-D20240628-T2023-ZP0800.tar.gz
tar -xzvf chorke-nginx_academia-production-D20240628-T2023-ZP0800.tar.gz
tar -xzvf chorke-nginx_academia-production-D20240628-T2023-ZP0800.tar.gz -C chorke-nginx-academia-production
|
Explanation
|
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
|
Cheatsheet | |||||
|---|---|---|---|---|---|
| Type | Short | Compress | Decompress | Algorithm | ⚪ |
| tar.gz | -z | time tar -czvf nginx.2024-06-30T1519.tar.gz nginx |
time tar -xzvf nginx.2024-06-30T1519.tar.gz |
DEFLATE=LZ77+Huffman | 🟢 |
| tar.xz | -J | time tar -cJvf nginx.2024-06-30T1519.tar.xz nginx |
time tar -xJvf nginx.2024-06-30T1519.tar.xz |
LZMA2 | 🟠 |
| tar.bz2 | -j | time tar -cjvf nginx.2024-06-30T1519.tar.bz2 nginx |
time tar -xjvf nginx.2024-06-30T1519.tar.bz2 |
BZIP2 | 🟡 |
DateTime Format
|
DateTime Format | |
|---|---|
echo "$(TZ=UTC-8 date +'%Y-%m-%dT%H%M')"
echo "$(TZ=UTC-8 date +'%FT%H%M')"
BKP_DATE_N_TIME="$(TZ=UTC-8 date +'%FT%H%M')"
:'
2025-10-10T1010
├─ 2025-10-21
│ ├─ 2025 « %Y
│ ├─ 10 « %m
│ └─ 10 « %d
└─ T1010
├─ T « Time
├─ 10 « %H
└─ 10 « %M
'
|
|
References
|
References | ||
|---|---|---|