Extract 7z files with standard linux tools?

I know that you can extract .7z files with 7-zip.

Is there another standard linux program that can do this? Maybe one of these

tar
bzip2
xz
gzip

I will add that bsdtar can do this, but is not available on all systems.


Solution 1:

No. 7-Zip archives use LZMA and LZMA2, which are not supported by standard tools (they also use bzip2, but you still need to decode the header).

Solution 2:

7-zip archives can be extracted with p7zip (http://p7zip.sourceforge.net/) on Linux. It is included in the repositories of: Debian, Fedora, Ubuntu and possibly other distributions too.

List contents with (lower case L, for list):

7za l myarchive.7z

Extract contents:

7za x myarchive.7z

Solution 3:

The "standard" way to work with 7-Zip archives on Unix is to use P7ZIP. But since the 7-Zip format was designed primarily for Windows, you shouldn't really expect P7ZIP to come installed on Linux distributions by default.

If you want the benefit of LZMA compression on Unix, prefer XZ Utils.