[Solved]: unzip command not found


The unzip command in Linux is used to extract files and directories from ZIP archives. It is important in Linux as it allows users to easily extract compressed files, making it a convenient tool for handling and managing compressed data on the command line.

Sometimes, while trying to execute the unzip command, the users encounter an error, “unzip command not found.” There could be various potential reasons that invoke this error. However, you do not need to worry.

This post will unveil all those reasons and will provide descriptive solutions. The solutions are generic and applicable to all Linux distributions. However, we will practice/demonstrate the solutions on Ubuntu 22.04.

How to Fix the “unzip command not found” Error on Linux?

There are various reasons that invoke the “unzip commnad not found” error on Linux. First, let’s explore the reasons before getting into the solutions:

Missing Package

The unzip package may not be installed on the system. This can happen if the package was not included in the initial installation or if it was accidentally removed.

Incorrect PATH Configuration

The PATH environment variable is responsible for locating executable files. If the directory containing the unzip executable is not included in the PATH, the system won’t be able to find the command.

Our system does not have the unzip package installed. Thus, the following prompt appeared when we tried to run the unzip command.

unzip command not found | linuxgenie.net

Let’s dig into the solutions:

Solution 1: Install the unzip Package

The unzip command belongs to the “unzip” package, which may not be installed by default on your system. You can install the unzip package using your package manager to resolve this. The specific command may vary depending on your Linux distribution:

$ sudo apt install unzip    #Debian/Ubuntu
$ sudo dnf install unzip    #Fedora
$ sudo yum install unzip    #CentOS
$ sudo pacman -S unzip      #Arch
$ sudo zypper install unzip #OpenSUSE

unzip command not found | linuxgenie.net

Once installed successfully, run the command to verify the error has been resolved:

$ unzip

unzip command not found | linuxgenie.net

From the output, it is clear that the error has been removed after installation.

Solution 2: Add the unzip Command in the System’s PATH

If the unzip package is installed, but the command is not found, it might not be included in the system’s PATH variable. The PATH variable contains a list of directories where the system looks for executable files. To fix this, follow the steps provided below:

Step 1: Find the Command’s Path

First, you need to find the command’s path using the “which” command as follows:

$ which unzip

unzip command not found | linuxgenie.net

Step 2: Add the Path to the /.bashrc File

Once found, you can add the directory to the PATH variable by modifying your shell configuration file (e.g., ~/.bashrc or ~/.profile) and appending the directory to the PATH variable. We are adding it to the “/.bashrc” file, as in our case. First, open the “/.bashrc” file using the command below:

$ sudo nano ~/.bashrc

Add the command’s path at the end of the file as follows:

export PATH=/usr/bin:$PATH

unzip command not found | linuxgenie.net

To apply the changes, reload the path environments using the command:

$ source ~/.bashrc

unzip command not found | linuxgenie.net

That’s how you can get rid of the command not found error on Linux.

Wrap Up

The error “unzip command not found” occurs if the unzip package is not installed on your system or the package is not synchronized with the system’s path. You can easily install the unzip utility by following the commands as per your Linux distributions. If the package is installed, but your system is unable to locate it. Then, you can obtain the path using the find command and add it to the “/.bashrc” file to solve the error.

This post has listed the possible reasons and the solutions to fix the error “unzip command not found” on Linux. Want to explore more troubleshooting guides on Linux? Visit Linux Genie and subscribe to our newsletter.

Print Friendly, PDF & Email
Categories