7zip File: How to Uncompress 7z files on Ubuntu, Debian, Fedora

by SathiyaMoorthy on April 23, 2010

Question: How do I uncompress a *.7z file ( 7zip file ) in UNIX / Linux ? Can you explain with a simple example?

Answer: Use 7za command to unzip a 7z file ( 7zip file ) on Unix platform as shown below.

Verify whether you have 7za command on your system.

# whereis 7za
7za: /usr/bin/7za /usr/share/man/man1/7za.1.gz

If you don’t have 7za command, install p7zip package as shown below.

Install p7zip to unzip *.7z files on Fedora

# yum install p7zip

Install p7zip to unzip *.7z files on Debian and Ubuntu

$ sudo apt-get install p7zip

Uncompressing a *.7z 7zip files in Linux using 7za

$ 7za e myfiles.7z 

7-Zip (A) 9.04 beta  Copyright (c) 1999-2009 Igor Pavlov  2009-05-30
p7zip Version 9.04 (locale=C,Utf16=off,HugeFiles=on,1 CPU)

Processing archive: ../../myfiles.7z

Extracting  myfiles/test1
Extracting  myfiles/test2
Extracting  myfiles/test
Extracting  myfiles

Everything is Ok

Folders: 1
Files: 3
Size:       7880
Compressed: 404
  • 7za – command name
  • e – specifies the 7z to be extracted
  • myfiles.7z – is the file that is to be extracted

Creating a 7zip compression file in Linux

$ 7za a myfiles.7z myfiles/

7-Zip (A) 9.04 beta  Copyright (c) 1999-2009 Igor Pavlov  2009-05-30
p7zip Version 9.04 (locale=C,Utf16=off,HugeFiles=on,1 CPU)
Scanning

Creating archive myfiles.7z

Compressing  myfiles/test1
Compressing  myfiles/test2      

Everything is Ok

Files and sub directories of myfiles/ will be added to the myfiles.7z.

  • a – add to archive
  • file.7z – archive file to which these files and dir from dir1 will be added to.

Share

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 4 comments… read them below or add one }

1 Rick Stanley April 23, 2010 at 10:53 am

“7zip File: How to Uncompress 7z files on Ubuntu, Debian, Fedora”

This applies to most Distros of Linux. The only difference is the package installation/update system the Distro uses. A better title would be:

“7zip File: How to Uncompress 7z files on Linux”

http://distrowatch.com/

2 shiriy April 23, 2010 at 11:49 am

I use 7z command

3 LHammonds October 28, 2011 at 7:26 pm

It is not a good idea to use 7zip by itself to backup and restore *nix files because it will not retain the owner or group for the files. Instead of using it directly, 1st tar the files into a single archive and then compress the tar with 7zip. Example:

tar -cpf – /home/goober | 7za a -si -mx=9 /tmp/myarchive.tar.7z 1>/dev/null 2>&1

4 Ramachandra November 27, 2011 at 4:46 am

$ sudo apt-get install p7zip-full
should be the command to install p7zip to unzip *.7z files on Ubuntu

Leave a Comment

Previous post:

Next post: