Learn How to Install 7zip on Ubuntu and Create 7zip Archive Files

7zip for Ubuntu Linux, provides by the p7zip-full package which we can install using the apt-get install command.

sudo apt-get install p7zip-full

Ubuntu p7zip-full package provides both command line tool and GUI tool to create 7zip archives.

Create 7zip archive file in Ubuntu

The 7za command uses to create 7zip files from the command line. To create archive we use the "a" option.

7za a file.7z filename

Example

7za a home.7z /home

As per the above example, we add all files from directory /home to 7zip archive called home.7z.

Example - Create password protected 7zip file

We can set a password for the 7 zip file with -p option.

7za a -pmypass home.7z /home

Create home.7z archive file with "mypass" as the password.

Extract 7zip files in Ubuntu

The 7za command with "x" option use to extract 7zip files in the command line.

Example

7za x home.7z

Extract home.7z file to the current working directory.

7za x -o/opt home.7z

This time we use the -o option to specify the directory which we want to extract the 7zip file.

How to use 7zip in Ubuntu Desktop

To create a 7zip file in Ubuntu Desktop, right click on the file or folder and click Compress. Then select the compression method as .7z to create the archive file in 7zip format.

To extract a 7zip file in Ubuntu Desktop, Rich click on the archive file and select "Extract Here".