Command not found after installing 7z - ubuntu

19.7k views Asked by At

thanks so much for your help. First ever questions here :) Just getting started with linux / ubuntu. have dabbled for years but fully converted recently... anywhoo...

I installed 7z but the command is not found. I restarted the computer to hopefully refresh commands but that didn't help either..

here is what I did:

sudo apt-get install p7zip
sudo apt-get install p7zip-full

then tried:

7z e [file-name].xz

and

7za e [file-name].xz

then I read up the man file but still nothing. every time i get the following reply:

/usr/local/bin/7z: 2: /usr/local/bin/7z: /usr/local/lib/p7zip/7z: not found

thanks so much already for the help!

4

There are 4 answers

2
Contropist On

I had the same problem. Use sudo apt-get install p7zip-full to solve this.

0
Wing Justin On

/usr/lib/p7zip/7z x your_file_name can fix the issue.

Or you can edit usr/local/bin/7z:

sudo vim /usr/local/bin/7z

replacing:

/usr/local/lib/p7zip/7z

with:

/usr/lib/p7zip/7z

The result is as follows:

(base) j@lab:~/doc/code$ 7z x deep_motion_mag-master.7z
/usr/local/bin/7z: 2: /usr/local/bin/7z: /usr/local/lib/p7zip/7z: not found
(base) j@lab:~/doc/code$ 7z x deep.7z
7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,32 CPUs)
Processing archive: deep.7z
Extracting  deep
Extracting  deep/configs
...

Every user can use 7z.

0
Amadeobee On

figured it out!

the path in the bin file was pointing to the wrong place.

i needed to switch the direction from the

usr/local/lib/p7zip/ 

directory to

usr/lib/p7zip/

directory....

0
zuiyixin On

I use OpenEuler system(based on Linux).Here are two ways that might work:

1.Manually Add environment variables

Open the terminal window and enter the following command to manually add 7zip's installation path to system environment variables:

export PATH=$PATH:/usr/bin/7z

This will add the 7zip installation path to the PATH environment variable so that the 7Z command can be found in the terminal.If 7zip is installed on other paths, you need to modify the path in the above command accordingly.

2.Re -installation of 7zip

If you manually add environment variables, you can try to reinstall 7zip software to ensure that it has been correctly installed in the system.

sudo dnf remove p7zip
sudo dnf install p7zip

The above command will uninstall the existing 7zip software and then reinstall it. If the installation is successful, the 7z command should be ready to use.

Hopefully this will solve your problem