In this article we are going to shows how to use wget command in Linux Terminal. If you want to learn about wget command in Linux with Examples then this post is ideal for you.
Wget is a command line utility that is used to downloading files in Linux system from web. Wget command allows you to download files with FPT, HTTP, HTTPS protocols.
Wget command has many options to easily download multiple files, recursive downloads, limit the bandwidth, mirror a website, resume downloads, download in background and many more.
Installing wget Utility in Linux
At present, wget utility is pre-installed on most of all Linux distributions. To check if wget installed or not on your Linux system, simply open your terminal, and run wget command . If wget utility is installed then it will display a output as below otherwise it will print that wget command not found
.
$ wget
Output
wget: missing URL
Usage: wget [OPTION]… [URL]…
Try 'wget --help' for more options.
If wget utility is not installed on your Linux system then you can install it using below steps:
Install wget command in Debian or Ubuntu
Run the below command to install wget on Debian or Ubuntu system:
sudo apt install wget
Install wget command in CentOS or Fedora
Run the below command to install wget on CentOS or Fedora system:
sudo yum install wget
Wget Command in Linux (Syntax)
In the Linux, the basic syntax of the wget command is show as below:
$ wget [OPTIONS] [URL]
Examples of Wget Command in Linux
How to Download a File using wget
$ wget https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe
Download and Save the File With a Different Name
Use -
o option with the wget command to download and Save the file with a different name:
$ wget -O notepad++.exe https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe
The above command will download the file from web and save it with name notepad++.exe
to your current directory.
Download File to a Specific Directory
Use -
p option with the wget command to download file to a specific directory:
$ wget -P /home/studiesonline https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe
The above command download the file and store it at given /home/
studiesonline directory.
Download multiple files at once
To download multiple files at once, simply specify the multiple urls along with wget command as show in below command:
$ wget https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe https://go.skype.com/skypeforlinux-64.deb
Limit the Download Speed with wget command
To manage file downloading speed, use --limit-rate
option with the wget command as show below:
$ wget --limit-rate=512k https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe
Use k
suffix for kilobytes and m
suffix for megabytes.
Download file with FTP protocol using wget command
Use --ftp-user
and --ftp-password
option to download password protected file using FTP protocol as show in below command:
$ wget --ftp-user=ftp_username --ftp-password=ftp_password ftp://ftp.studiesonline.in/back_up.zip
Resume downloading with Wget command
Use -c
option with wget command to resume a uncompleted downloads:
$ wget -c https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe
Download in Background with Wget
Use -b option with the wget command to download a file in background as show below:
$ wget -b https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.8/npp.7.8.8.Installer.exe
Use the tail command to watch the status of the downloading:
$ tail -f wget-log
Create a Mirror of a Website using wget command
Use -m
option with the wget command to reate a mirror of the website:
$ wget -m https://example.com
To browse downloaded files, use use below options with wget command:
$ wget -m -k -p https://example.com
Skip SSL Certificate Check with Wget Command
If host has an invalid SSL certificate then use the --no-check-certificate
option to skip certificate check :
$ wget --no-check-certificate https://example.com/myFile.txt
That’s all
If you face any error and issue in above steps , please use comment box below to report.
If our tutorials helped you, please consider buying us a coffee. We appreciate your support!
Thank you for your support.