7Zip: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 54: Line 54:
==DateTime Format==
==DateTime Format==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
echo "$(date +'D%Y%m%d-T%H%M')-Z$(date +'%z'|tr '+-' 'PM')"
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')"
:'
:'
D20240628-T2023-ZP0800
2025-10-10T1010
├─ D20240628
├─ 2025-10-21
│  ├─ D    « Date
│  ├─ 2025 « %Y
│  ├─ 2024 « %Y
│  ├─  10 « %m
│  ├─ 06   « %m
│  └─  10 « %d
│  └─ 28   « %d
└─ T1010
├─ -T2023
  ├─    T « Time
│  ├─ -   « -
  ├─  10 « %H
│  ├─ T   « Time
  └─  10 « %M
│  ├─ 20   « %H
│  └─ 23   « %M
└─ -ZP0800
  ├─ -    « -
  ├─ Z    « Zone
  ├─ P    « {P: Plus (+), M:Minus (-)}
  └─ 0800 « Time Offset
'
'
</syntaxhighlight>
</syntaxhighlight>

Revision as of 13:36, 21 October 2025

sudo apt -qq update
sudo apt install -y p7zip-full
7z

Compress

cd /etc/nginx
7z a chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z sites-enabled
7z a chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z sites-enabled  -psadaqah!
7z a chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z sites-enabled '-psadaqah!'
7z a chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z sites-enabled '-x!default'
7z a chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z sites-enabled '-xr!default'

Decompress

7z l chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z
7z e chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z
7z x chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z
7z x chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z  -psadaqah!
7z x chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z '-psadaqah!'
7z x chorke-nginx_academia-production-D20240628-T2023-ZP0800.7z -o./chorke-nginx-academia-production/

Commands

 a : Add files to archive
 b : Benchmark
 d : Delete files from archive
 e : Extract files from archive (without using directory names)
 h : Calculate hash values for files
 i : Show information about supported formats
 l : List contents of archive
 rn : Rename files in archive
 t : Test integrity of archive
 u : Update files to archive
 x : eXtract files with full paths

Cheatsheet

Type Compress Decompress Algorithm
7z time 7z a nginx_20240630-T1519-ZP0800.7z  nginx time 7z x nginx_20240630-T1519-ZP0800.7z LZMA, LZMA2, PPMd, BZIP2, DEFLATE, Store 🟠
zip time 7z a nginx_20240630-T1519-ZP0800.zip nginx time 7z x nginx_20240630-T1519-ZP0800.zip DEFLATE, BZIP2, LZMA, Store 🟢
tar.gz time tar cf - nginx|7z a -si nginx_20240630-T1519-ZP0800.tar.gz time 7z x nginx_20240630-T1519-ZP0800.tar.gz  -so|7z x -si -ttar -onginx DEFLATE=LZ77+Huffman 🟢
tar.xz time tar cf - nginx|7z a -si nginx_20240630-T1519-ZP0800.tar.xz -txz time 7z x nginx_20240630-T1519-ZP0800.tar.xz  -so|7z x -si -ttar -onginx LZMA2 🟠
tar.bz2 time tar cf - nginx|7z a -si nginx_20240630-T1519-ZP0800.tar.bz2 -tbzip2 time 7z x nginx_20240630-T1519-ZP0800.tar.bz2 -so|7z x -si -ttar -onginx BZIP2 🟡

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