HOW TO INSTALL 7ZIP (7Z) ARCHIVE TOOL IN UBUNTU 16.04
Introduction
In this article we are going to learn How to install 7Zip (7z) archive tool in Ubuntu 16.04. it’s an open source file archive tool like gzip, bzip2 or any other file compressor tool. The file extension of 7zip archive tool is 7z. The main advantage of 7zip archive tool is apart from .7z file format it can extract other compressed file formats i.e. iso, rar, zip, bz2, gz, wim and so on. 7zip is available in 85+ languages. The application was initially written by Igor Pavlov on year 1999 using C++ programming language and released under GNU GPL License. It’s an cross platform application available for major operating systems i.e. Linux, Unix, Microsoft Windows, Mac OS.
Follow the below steps to install 7zip (7z) archive tool in Ubuntu 16.04
Before start the installation let’s update the packages and repositories of Ubuntu 16.04 using below command.
elinuxbook@ubuntu:~$ sudo apt-get update # Update Packages & Repositories
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done
After update the packages and repositories now we can go ahead and install 7zip (7z) archive tool using below command.
elinuxbook@ubuntu:~$ sudo apt-get install p7zip-full # Install 7z archive tool
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
p7zip-rar
The following NEW packages will be installed:
p7zip-full
0 upgraded, 1 newly installed, 0 to remove and 422 not upgraded.
Need to get 919 kB of archives.
After this operation, 3,959 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 p7zip-full amd64 9.20.1~dfsg.1-4.2 [919 kB]
Fetched 919 kB in 7s (131 kB/s)
Selecting previously unselected package p7zip-full.
(Reading database ... 174198 files and directories currently installed.)
Preparing to unpack .../p7zip-full_9.20.1~dfsg.1-4.2_amd64.deb ...
Unpacking p7zip-full (9.20.1~dfsg.1-4.2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up p7zip-full (9.20.1~dfsg.1-4.2) ...
Also Read :
As you can see above we have successfully installed the 7zip archive tool. To confirm the same refer the below command.
elinuxbook@ubuntu:~$ sudo dpkg -l p7zip-full # Confirm the installed Package
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================================-=======================-=======================-=============================================================================
ii p7zip-full 9.20.1~dfsg.1-4.2 amd64 7z and 7za file archivers with high compression ratio
Now let’s do some exercises and compress, extract and list files using 7zip (7z) archive tool.
Compress a File :
Here I have a file named file.txt and I am going to compress that file using 7z command. Refer the command below. option a used to add file in 7z compression.
elinuxbook@ubuntu:~/data$ 7z a file.7z file.txt # Compress a file using 7zip archive tool 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU) Scanning Creating archive file.7z Everything is Ok # Confirm the archived file elinuxbook@ubuntu:~/data$ ls file.7z file.txt
List the contents of a 7zip archive file :
You can list the contents of a 7zip archive file using 7z command with option l.
elinuxbook@ubuntu:~/data$ 7z l file.7z # List the content of a 7z file 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU) Listing archive: file.7z -- Path = file.7z Type = 7z Solid = - Blocks = 0 Physical Size = 84 Headers Size = 84 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2017-10-19 08:55:05 ....A 0 0 file.txt ------------------- ----- ------------ ------------ ------------------------ 0 0 1 files, 0 folders
Extract a File :
To extract a 7zip file you can use 7z command with option e.
elinuxbook@ubuntu:~/data$ 7z e file.7z # Extract the 7z file
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
Processing archive: file.7z
Extracting file.txt
Everything is Ok
Size: 0
Compressed: 84
To uninstall the package use the below command.
elinuxbook@ubuntu:~/data$ sudo dpkg -r p7zip-full # Uninstall the 7zip Package
[sudo] password for elinuxbook:
(Reading database ... 179125 files and directories currently installed.)
Removing p7zip-full (9.20.1~dfsg.1-4.2) ...
Processing triggers for man-db (2.7.5-1) ...
This is how we can install 7zip (7z) archive tool in Ubuntu 16.04. If you found this article useful then Like us, Share this post on your preferred Social media, Subscribe our Newsletter OR if you have something to say then feel free to comment on the comment box below.