cybrkyd

tar and 7zip one-liners

 Sun, 22 Jun 2025 10:32 UTC
tar and 7zip one-liners
Image: CC BY 4.0 by cybrkyd

My cheat sheet of tar and 7zip one-liners.

Add folder to .tar

tar -cpvf archive.tar folder/

Extract .tar

tar -xvf archive.tar

Compress to .tar.gz

tar -zcvf archive.tar.gz folder/

Add folder to .7z

7z a archive.7z folder/

Extract .7z

7z x archive.7z

Test .7z archive

7z t archive.7z * -r

Password on .7z with no compression

# -p: password (prompted)
# -mx0: no compression
# -mhe: header encryption, to encrypt file names

7z a -p -mx0 -mhe -t7z archive.7z folder/

Split archives

# -v20m: Volume split size, 20 MB

7z -v20m a -mx0 archive.7z folder/

Extract split archive

# Extract the first one

7z x folder.7z.001
»
Tagged in: #oneliners #CheatSheet

Visitors: Loading...