How to use Wget Command in Linux Ubuntu 19.10/18.04 LTS?

Download any file easily using Wget Command!!

Wget Command

Wget Command in Linux: Wget is a command-line utility of Linux that lets you download files from the web. It is a non-interactive downloader, meant that it can work well in the background without obstructing the current process. The Wget command supports protocols like HTTP, HTTPS, and FTP, as well as retrieval by means of HTTP proxies. Users don’t have to log on to the system for using the wget command. Many web browsers require continual user presence while transferring a lot of download data. But, this command has been designed for robustness over an unstable or slow internet connection. So, if your download interrupts or fails due to a network problem, it will keep on trying to download the file until the download gets completed. It will command the server to resume the download where it left off so you don’t have to worry about any sort of network error. In this article, we will help you with how to use wget command in Linux Ubuntu.

Table of Contents:

Wget Command – Download Syntax:

In order to download a file from the web, you have to follow the below syntax of Wget Command.

wget [option] [URL]

Sample Download using Wget Command:

  • First, you have to copy the URL of a file which you want to download it in your system.
  • Then, click on the shortcut CTRL+ALT+Ton Linux Ubuntu to open the Terminal.
  • In the terminal, you have to type wget and then right-click on the terminal.
  • Now, click on the paste option to paste the downloading URL.
    Wget - Download URL
    Wget – Download URL
  • Click Enter to begin the download process.
  • Now, the download gets completed.
    Wget Command - Download Completed
    Wget Command – Download Completed

Diverse Examples of Wget Command usage:

Let’s look out some examples of using Wget command with the available flags and options.

Display Wget Version:

Execute any one of the below commands to know the version of wget available on your system.

wget --version
wget -V
Display Wget Version
Display Wget Version

To download the file in background:

wget -b [URL]

To resume a partially downloaded file:

wget -c [URL]

Help option of Wget command:

In order to get help from the Wget command, you have to execute any one of the following commands on the Ubuntu Terminal.

wget --help
wget -h

Wget Command – Download Options:

  -t,  --tries=NUMBER              set number of retries to NUMBER (0 unlimits)
       --retry-connrefused         retry even if connection is refused
       --retry-on-http-error=ERRORS    comma-separated list of HTTP errors to retry
  -O,  --output-document=FILE      write documents to FILE
  -nc, --no-clobber                skip downloads that would download to
                                     existing files (overwriting them)
       --no-netrc                  don't try to obtain credentials from .netrc
  -c,  --continue                  resume getting a partially-downloaded file
       --start-pos=OFFSET          start downloading from zero-based position OFFSET
       --progress=TYPE             select progress gauge type
       --show-progress             display the progress bar in any verbosity mode
  -N,  --timestamping              don't re-retrieve files unless newer than
       --no-if-modified-since      don't use conditional if-modified-since get
                                     requests in timestamping mode
       --no-use-server-timestamps  don't set the local file's timestamp by
                                     the one on the server
  -S,  --server-response           print server response
       --spider                    don't download anything
  -T,  --timeout=SECONDS           set all timeout values to SECONDS
       --dns-timeout=SECS          set the DNS lookup timeout to SECS
       --connect-timeout=SECS      set the connect timeout to SECS
       --read-timeout=SECS         set the read timeout to SECS
  -w,  --wait=SECONDS              wait SECONDS between retrievals
       --waitretry=SECONDS         wait 1..SECONDS between retries of a retrieval
       --random-wait               wait from 0.5*WAIT...1.5*WAIT secs between retrievals
       --no-proxy                  explicitly turn off proxy
  -Q,  --quota=NUMBER              set retrieval quota to NUMBER
       --bind-address=ADDRESS      bind to ADDRESS (hostname or IP) on local host
       --limit-rate=RATE           limit download rate to RATE
       --no-dns-cache              disable caching DNS lookups
       --restrict-file-names=OS    restrict chars in file names to ones OS allows
       --ignore-case               ignore case when matching files/directories
  -4,  --inet4-only                connect only to IPv4 addresses
  -6,  --inet6-only                connect only to IPv6 addresses
       --prefer-family=FAMILY      connect first to addresses of specified family,
                                     one of IPv6, IPv4, or none
       --user=USER                 set both ftp and http user to USER
       --password=PASS             set both ftp and http password to PASS
       --ask-password              prompt for passwords
       --use-askpass=COMMAND       specify credential handler for requesting 
                                     username and password.  If no COMMAND is 
                                     specified the WGET_ASKPASS or the SSH_ASKPASS 
                                     environment variable is used.
       --no-iri                    turn off IRI support
       --local-encoding=ENC        use ENC as the local encoding for IRIs
       --remote-encoding=ENC       use ENC as the default remote encoding
       --unlink                    remove file before clobber
       --xattr                     turn on storage of metadata in extended file attributes
Recursive download:
  -r,  --recursive                 specify recursive download
  -l,  --level=NUMBER              maximum recursion depth (inf or 0 for infinite)
       --delete-after              delete files locally after downloading them
  -k,  --convert-links             make links in downloaded HTML or CSS point to
                                     local files
       --convert-file-only         convert the file part of the URLs only (usually known as the basename)
       --backups=N                 before writing file X, rotate up to N backup files
  -K,  --backup-converted          before converting file X, back up as X.orig
  -m,  --mirror                    shortcut for -N -r -l inf --no-remove-listing
  -p,  --page-requisites           get all images, etc. needed to display HTML page
       --strict-comments           turn on strict (SGML) handling of HTML comments

A Short Summary:

In the above article, we have explained how to use wget command on Linux Ubuntu 19.10 Eoan Ermine/ 18.04 LTS Bionic Beaver. In addition, we have provided some options for Wget command that let you understand the usage of the command clearly. Is this article helpful? Don’t forget to share your queries/suggestions in the below comment section.


Check this too  GZip Command in Linux: Essential GZip Command Syntax & Examples

Leave a Reply

Your email address will not be published. Required fields are marked *


Written by Lisa

Lisa is a technical writer who assists readers with quality content as part of a Tec Robust team. Her writing helps people from diverse professional backgrounds. Her article makes you gain clarity on technical topics as she knows what is right for you.

Apache NetBeans

How to Install Apache NetBeans for Fedora 31?


How to Install Node.js on Fedora 31 ?