How can I uncompress a *.7z file?
How can I uncompress a *.7z file in Ubuntu and keep the directory structure?
6 Answers
First install the p7zip-full package:
sudo apt-get install p7zip-fullWith this, Nautilus should have an option to uncompress 7-Zip Files.
I also recommend p7zip-rar so it also includes support for RAR files.
This is assuming you want to do it via GUI with Nautilus. If not, after downloading the packages above do the following:
7z x PACKAGE.7z that should eXtract the packages with full path.
6There is also dtrx - which is immensely useful for un-archiving anything.
it stands for "Do The Right eXtraction" - and will uncompress anything without any fuss.
simply:
sudo apt-get install dtrx
dtrx archive.tar.XXManpage:
UPDATE for Ubuntu 20.04 :
According to their pypi page, dtrx is not currently available in the official repos. Thus, if you cannot install this via apt, then you can still use pip3:
pip3 install dtrxIf you don't already have pip3 installed, you can install it with
sudo apt install python3-pip 5 Run following command in the terminal:
sudo apt-get install p7zip-full p7zip-rarOr search through the ubuntu software center as 7zip and unrar and install the packages.
For ubuntu 17.04, no need for the full package, p7zip is enough:
sudo apt install p7zipThen, uncompress using the -d command:
p7zip -d something.7z 3 First install the according packagesudo apt install p7zip-full
- use
xflag to extract files with full path - use
-oflag to set output directory
7z x <archive_name> -o{Directory}
for example
7z x file.7z -o/home/michael/Documents/NewFolder
Notice that there is no space between -o and the output directory. If the file was encrypted, it will automatically ask for the password.
The other answers did not work for me.
But this command worked fine:
7z e file.7z 1