p7zip(1)

๐Ÿ“ฆ
version 26.02 ยท 2 versions
  • 26.02 ยท debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 26.02 ยท opensuse-leap 16.0
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

๐ŸŽ€ p7zip โ€” the manual, bestie edition ๐ŸŽ€

Okay so picture this: it's the General Commands Manual, and the star of the show is p7zip</p7zip>... wait no, <pink>p7zip</pink> โ€” a lil wrapper sitting on top of the 7-Zip file archiver, and the whole point of it is a compression ratio so high it's giving overachiever. ๐Ÿ’…


โœจ NAME โœจ

p7zip โ€” a wrapper on the 7-Zip file archiver, and it has a high compression ratio. That's it, that's the name. ๐Ÿซถ


โœจ SYNOPSIS โœจ

p7zip [-c|--stdout|--to-stdout] [-d|--decompress|--uncompress]
[-f|--force] [-h|--help] [-k|--keep] [--] [file ...]

โœจ DESCRIPTION โœจ

So 7-Zip is a file archiver, right? And it supports a whole roster of formats, no cap:

  • 7z โ€” and this one implements the LZMA compression algorithm, which features a very high compression ratio ๐Ÿ‘‘
  • LZMA2
  • XZ
  • ZIP
  • Zip64
  • CAB
  • RAR โ€” but only if the non-free p7zip-rar package is installed, just so you know ๐Ÿซฃ
  • ARJ
  • GZIP
  • BZIP2
  • TAR
  • CPIO
  • RPM
  • ISO
  • most filesystem images
  • DEB

And the compression ratio in the new 7z format? It's 30-50% better than the ratio in ZIP format. Ate. Periodt. ๐Ÿ”ฅ

Now โ€” p7zip itself is a gzip-like CLI wrapper script for 7-Zip. It handles only the 7z format (which is the native format of 7-Zip, iykyk), and internally it executes either 7za(1) or 7zr(1). So it's the friendly face, and those are the ones actually doing cardio behind the scenes. ๐Ÿƒโ™€๏ธ

Here's how it actually behaves, bestie:

  • If you pass no switches on the command line, each given file argument gets compressed into file.7z, and then it gets removed. Gone. Deleted. Bye. ๐Ÿ˜ญ
  • If you pass the -d switch, then each file you pass needs to end with the .7z extension, and it gets decompressed. After the decompression, the original file is removed โ€” unless it contained more than one archived file. (So multi-file archives get to stay. Main character energy. ๐Ÿ’–)
  • If you use it with no file argument at all, p7zip reads data from the standard input and compresses it (or decompresses it, in the case of -d) into the standard output. Stream queen behavior. ๐ŸŒŠ

โœจ SWITCHES โœจ

  • -c, --stdout, --to-stdout โ€” Write output on standard output. โœจ
  • -d, --decompress, --uncompress โ€” Decompress file. ๐Ÿฆ‹
  • -f, --force โ€” Skip some checks and force compression or decompression. (It's giving "I said what I said.") ๐Ÿ’…
  • -h, --help โ€” Print usage. ๐ŸŒธ
  • -k, --keep โ€” Do not delete input file. Protect the file at all costs. ๐Ÿฅบ
  • -- โ€” Treat all subsequent arguments as file names, even if they start with a dash. So no, that weirdly-named file is not a secret option. ๐ŸŽ€

โœจ SEE ALSO โœจ

7z(1), 7za(1), 7zr(1), bzip2(1), gzip(1), zip(1)

(the whole friend group ๐Ÿซถ go say hi)


โœจ AUTHOR โœจ

Written for Debian by Mohammed Adnene Trojette. Updated by Robert Luberda. Legends, honestly. ๐Ÿ‘‘


And that's the whole page, bestie!! This one came from the 7-Zip crew and it's dated March 6th, 2016 โ€” so go forth, compress things, and remember: -k if you're emotionally attached. ๐Ÿ’œ๐Ÿฆ‹โœจ