How to install wget on a Debian or Ubuntu Linux

I recently switched from Windows server operating system to Debian Linux for my PHP based apps. I need to install something using wget. But it says:
    bash: wget: command not found
How do I solve this problem? How can I install wget tool on a Debian Linux home server?

The GNU Wget is a free and open source tool for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies and much more. Let us see how to search for a package named wget to retrieves files from the web and install the same on your server.

Installing wget on a Debian Linux

You need to use the apt-get command/apt command to install any package including wget. You can search for package name using the apt-cache command. The syntax is:
$ apt-cache search {package}
$ apt-cache search wget
$ apt-cache search wget | grep wget
$ apt search wget

Sample outputs:

Fig.01: apt-cache search command search performs a full text search on all available package lists

The second last result indicate that the package name is wget. To install wget package use the following syntax:
$ sudo apt-get install {package-name-here}
OR directly run as root user:
# apt-get install {package-name-here}
For example, install wget using the apt-get command/apt command command line as follows:
$ sudo apt install wget
$ sudo apt-get install wget
Sample outputs:

Fig.02: Installing wget on a Debian or Ubuntu Linux

How to use wget command

Once installed you can grab or download file using the following syntax
wget http://url/file
wget ftp://domain/file.tar.gz

See the following wget command related tutorials for more info:

  1. How to use wget command
  2. How To Use wget With Username and Password for FTP / HTTP File Retrieval
  3. Run wget In Background For an Unattended Download of Files on Linux and Unix
  4. Use wget Command To Download Files From HTTPS Domains
  5. Wget: Resume Broken Download
This entry is 3 of 5 in the Linux/Unix install wget Tutorial series. Keep reading the rest of the series:

  1. Freebsd Install wget Utility To Download Files From The Internet
  2. How to install wget on RHEL 8 using the dnf command
  3. How to install wget on a Debian or Ubuntu Linux
  4. How to install wget on RHEL/CentOS 7 using yum
  5. Mac OS X Sierra Install wget Network Downloader Utility

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.