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 version 6/7/8/9/10?

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 powered by Debian Linux 7/8/9/10.
Tutorial requirements
Operating system/appDebian or Ubuntu Linux
Root privileges requiredYes
DifficultyEasy (rss)
Estimated completion time2m
Table of contents

ADVERTISEMENTS

Update your systems and apt repos

The syntax is as follows to update to resynchronize the package index files from their sources:
$ sudo apt-get update
# Install the newest versions of all packages currently installed#
$ sudo apt-get upgrade

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

Finding information about wget

Simply run the following command:
$ sudo apt info wget
## or use the apt-cache command ##
$ sudo apt-cache show wget

Package: wget
Architecture: amd64
Version: 1.20.3-1ubuntu1
Multi-Arch: foreign
Priority: standard
Section: web
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Noël Köthe <noel@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 992
Depends: libc6 (>= 2.17), libidn2-0 (>= 0.6), libpcre2-8-0 (>= 10.32), libpsl5 (>= 0.16.0), libssl1.1 (>= 1.1.0), libuuid1 (>= 2.16), zlib1g (>= 1:1.1.4)
Recommends: ca-certificates
Conflicts: wget-ssl
Filename: pool/main/w/wget/wget_1.20.3-1ubuntu1_amd64.deb
Size: 348824
MD5sum: ae9eb859432505828dab97c80edcb5b5
SHA1: 45504b6e948d4f1a7e2ba0233bb57a67b392ceea
SHA256: 68144dde6d45e1a54fa983d6d10be7043e6695e259c8d2b12fd03ea5e475d56a
Homepage: https://www.gnu.org/software/wget/
Description-en: retrieves files from the web
 Wget is a network utility to retrieve files from the web
 using HTTP(S) and FTP, the two most widely used internet
 protocols. It works non-interactively, so it will work in
 the background, after having logged off. The program supports
 recursive retrieval of web-authoring pages as well as FTP
 sites -- you can use Wget to make mirrors of archives and
 home pages or to travel the web like a WWW robot.
 .
 Wget works particularly well with slow or unstable connections
 by continuing to retrieve a document until the document is fully
 downloaded. Re-getting files from where it left off works on
 servers (both HTTP and FTP) that support it. Both HTTP and FTP
 retrievals can be time stamped, so Wget can see if the remote
 file has changed since the last retrieval and automatically
 retrieve the new version if it has.
 .
 Wget supports proxy servers; this can lighten the network load,
 speed up retrieval, and provide access behind firewalls.
Description-md5: 63a4a740bcd9e8e94bf661e4f1806e02
Task: standard

How to install wget on a Debian or Ubuntu Linux

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 [options] https://www.cyberciti.biz/
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

Removing wget command

We can reverse installation by typing any one of the following command to get rid of the wget command:
$ sudo apt-get remove wget
## or ##
$ sudo apt remove wget

Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  wget
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 3335 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 14429 files and directories currently installed.)
Removing wget (1.20.1-1.1) ...

Conclusion

We shown you have to install wget on Ubuntu or Debian Linux using the command line. See wget home page for more information.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
4 comments… add one
  • horst Feb 16, 2017 @ 7:08

    what a dump f**k !!!!!

    • 🐧 Vivek Gite Feb 16, 2017 @ 7:32

      So you were born with all knowledge and you have never once needed to seek information??? Be nice to new users.

  • Thrbn Feb 16, 2017 @ 7:16

    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 :)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.