How to install wget on a Debian or Ubuntu Linux

Posted on in Categories , , last updated February 16, 2017

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
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
OR
$ sudo apt-get install wget
Sample outputs:
Fig.02: Installing wget on a Debian or Ubuntu Linux
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

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

4 comment

  1. Is there any bad thing about using apt install and apt search instead of apt-get and apt-cache? As I understand it, apt search is newer and also has a nicer more colorful output :)

Comments are closed.