Uncompress 7z files through command line

Today I learned that with Nautilus (installed in ZorinOS Core) you can right-click on archived files using the .7z extension and extract them. However before that I spend a while looking online for a command line tool that can do the same in Linux, as my first options such as zip, unzip or tar wouldn't work.

There were several options but a lot of the answers I found were about 10 years old so I was wondering if someone has a better solution that doesn't involve installing external packages? Or, if there's maybe a way to access the Nautilus' built-in functionality to do these sort of thing?

1 Like

Already tried renaming the extension? I remember that years ago when I downloaded a picture in a weird format and just edited the extension piece to open it correctly. But seems working only when switching from an extension type to another but that does the same, so for example you can open a .zip renaming it .7z but renaming it .exe won't work.

2 Likes

Gday @zenzen ,
You should be able to double click any zip/7z file to Extract them.
You may need to install, Unzip.

sudo apt install unzip

Try via terminal. Use the command "unzip"
EG: you have a zip file called "Buttons.zip"
First change directory (cd ~/Downloads) to .zip file location. Then.

unzip Buttons.zip

Hope this may help.

3 Likes

Double-click or right-click and then extract both work normally. But from the command line I get an error:

$ unzip pastel_resources.7z

Archive:  pastel_resources.7z
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of pastel_resources.7z or
        pastel_resources.7z.zip, and cannot find pastel_resources.7z.ZIP, period.

It was worth a try, but unfortunately this didn't work. I also remember using this little trick years ago and it sometimes worked amazingly but I think mostly with compatible file formats.

1 Like

you need to be in the directory of the file first
Say you have it in Downloads Folder.
Then first:

cd ~/Downloads

Then

unzip pastel_resources.7z

^^^^ check that file name is correct?
It maybe pastel_resources.tar.7z ?

2 Likes

The filename is correct as well as the path provided to unzip. It just refuses to open it :man_shrugging: