1
0
mirror of https://github.com/tiyn/wiki.git synced 2025-04-04 07:47:45 +02:00
wiki/wiki/linux/7-zip.md

1.8 KiB
Raw Blame History

7-zip

7-zip is a free and open-source file archiver. It places files or directories in an archive and is able to compress them.

Setup

7-zip can be installed by installing the packages p7zip-full and p7zip-rar on Ubuntu systems. On Arch Linux it can be installed with the package 7-zip from the AUR.

Usage

The following section describes various ways of usage of 7-zip.

Compressing and Uncompressing a Directory

For directories to be compressed the LempelZivMarkov chain algorithm is recommended. It is fast with good compression results.

As explained by kenorb on superuser.com An effective way to compress a directory is the following command where directory is the directory that is to be compressed. The archive will be created by the same name as the directory but with the .7z extension. This command uses expansion. The directory is not deleted automatically afterwards.

7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on directory{.7z,}

To uncompress it run the following command.

7z x directory.7z

Peek Contents of an Archive

To list the content files of a 7-zip archive the following command can be used. The name of the archive is assumed to be directory.7z.

7z l directory.7z

Remove a File from an Existing Archive

To remove a file with the assumed name file.ext from an archive called directory.7z run the following command as explained by user3409415 on stack overflow.

7z d -r directory.7z file.ext