Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active June 9, 2018 16:39
Show Gist options
  • Save plembo/4b0b2d6bce966a65d7910e182546b001 to your computer and use it in GitHub Desktop.
Save plembo/4b0b2d6bce966a65d7910e182546b001 to your computer and use it in GitHub Desktop.
7z Examples for Linux

7z Examples for Linux

7zip on Linux is a port from Windows. The man page explicitly cautions against using it as a general purpose backup solution on Linux because it does not preserve file permissions. It can be more useful than Unix zip for creating cross-platform archives, however, as 7zip can be used to encrypt both data and filenames in an archive with strong 256-bit AEC encryption (Unix zip uses relatively weaker encryption limited to 96-bits for circa 2008 export compliance).

On Ubuntu, 7zip is suppled by the p7zip-full package.

As the result of syntax changes over the years anyone using 7zip on Linux should pay careful attention to its man pages and release notes.

  1. Create a password protected archive of a file or folder:
7z a -p beta.7z beta

The 7z file extension is mandatory, unless you use the -t option to set a different archive type.

  1. Do the same thing but with header and data encryption turned on:
7z a -mhe=on -p beta.7z beta

Header encrpytion prevents the reading of file and directory names.

  1. Extract a 7zip archive:
7z x beta.7z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment