How can I uncompress a *.7z file in Ubuntu and keep the directory structure?
First install the
sudo apt-get install p7zip-full
With 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.
There 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.
sudo apt-get install dtrx dtrx archive.tar.XX
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 install dtrx
If you don't already have pip3 installed, you can install it with
sudo apt install python3-pip