Linux provides the wget command in order to download files from the network and internet. The wget command is very popular amongst Linux users as it supports a lot of different protocols like HTTP, HTTPS, FTP, etc. As a command-line tool, the wget is called from the bash and when we try to run the wget command we may get the “bash: /usr/bin/wget: No such file or directory” error. There are different reasons for this error and the most probable reason is the wget is not installed for the current Linux distribution. In this tutorial, we will explain these error causes and solutions.
“bash: /usr/bin/wget: No such file or directory” Error
The wget command is not installed by default in most Linux distributions like Ubuntu, Debian, Mint, CentOS, etc. When we try to run it we will get the “bash: /usr/bin/wget: No such file or directory” error. This error is returned by the bash which is expressed with the “bash:” and says that the wget binary can not be found in the binary path /usr/bin. This is generally interpreted as the wget is not installed.
But we can be sure by searching the wget command and binary with the locate command which is used to search given name as file and folder. We will search wget with the locate command like below.
$ locate wget
From the output, we can see that there are some files related to the wget but they are on in a bin directory or a wget command. The wget command default path is
/usr/bin/wget and we can run the wget executable file directly by providing its path like below.
Install wget Command
The most popular and regular solution for the “bash: /usr/bin/wget: No such file or directory” error is installing the wget command. The wget command can be installed from a repository or via package files but installing from a repository with a package management tool is the best reliable and easy way. Below we will install the wget command for different Linux distributions and package managers.
Install wget For Ubuntu, Debian, Mint and Kali
The Ubuntu, Debian, Mint, and Kali distributions use the apt or apt-get package managers to install, update, and remove packages. We can install the wget command with the apt install or apt-get install command.
$ sudo apt install wget
$ sudo apt-get install wget
Install wget For CentOS, Fedora, RHEL
The CentOS, Fedora, and RHEL distributions use the yum or dnf package managers to install, update, and remove packages. We can install the wget command with the yum install or dnf install command.
$ sudo dnf install wget
$ sudo yum install wget
Display wget Command Version
After installing the wget command it can be checked in different ways but the most practical way is to check and display its version. The -V option can be used to display the version of the wget command like below.
$ wget -V