Linux Commands | Archive File Management | 7z Compress and Extract

Compress with 7z

Command

7zr a {archive file name}.zip {file or directory to compress 1} {file or directory to compress 2}...

Compress Files

The following command compresses the files test1, test2, and test3 into an archive named test.7z.

7zr a test.7z test1 test2 test3

Extract 7z

Command

7zr x {archive file name}.zip

The following command extracts the test.7z archive.

7zr x test.7z

Install p7zip

Install p7zip on Ubuntu

apt-get install p7zip

If installation with the command above does not work, search with the following command and install the appropriate package.

apt-cache search 7z

Install p7zip on Fedora

yum install p7zip

If installation with the command above does not work, search with the following command and install the appropriate package.

yum search 7z