How to resolve ‘bash wget command not found’ problem

29/12/2020
`wget` command is used on Linux to download files from the web. It is a free tool that supports http, https and ftp protocols, and http proxies for downloading any file. It is called non-interactive downloader because It can work in the background. So, the user can disconnect from the system after starting the download and the downloading task will be completed by this command as background process. Using this command is beneficial, when downloading files from slow or unstable network. If the network disconnects for any reason before completing the download task, then this command will keep trying to complete the download when connected with the network. Sometimes, the Linux user get the error message, “ –bash:wget:Command not found” while executing this command. It indicates that `wget` utility is not installed on the operating system or it is not working properly. How you can resolve this issue on Ubuntu operating system and download the file by using `wget` command are shown in this tutorial.

Syntax:

wget [option] [URL]

Option and URL parts are optional for this command.  There are many options exist for this command. Some basic start-up options for this command are, -V or –version, -h or –help, -b or –background and -e or –execute. URL will contain the location from where the file will be downloaded. The uses of some common options are explained with examples in this tutorial.

Check `wget` command is installed or not

Run the following command to check the installed version of `wget` command. If the command is not installed before then you will get the error, “ –bash:wget:Command not found”.

$ wget –V

The following output shows that wget command of version 1.19.4 is installed on the system.

Install wget command on Ubuntu

Run the following command to install wget command on Ubuntu.

$ sudo apt-get install wget

After completing the install, again run the previous command to check the install version of this command. Run the wget command with –h option to display all option details of this command.

$ wget -h

Example-1: wget command without any option

The following `wget` command will download the index.html file from the site, linuxhint.com and the file will be stored on the current working directory. ‘ls’ command is used here to check the html file is created or not in the current directory.

$ wget https://linuxhint.com
$ ls

Example-2: `wget` command with -b option  

‘-b’ option is used with `wget` to complete the download in the background. The following command will download, temp.zip file from the site, fahmidasclassroom.com in the background.

$ wget -b https://fahmidasclassroom.com/temp.zip

Example-3: `wget` command with -c option

‘-c’ option is used with `wget` to complete the partial download. It is mentioned in the beginning of this tutorial that `wget` command has resume capability. If any incomplete download exists in the current directory due to network error or other reason the `wget` will resumes the download to complete the task with ‘-c’ option. The following command will resume the download if the file, xampp-linux-x64-7.2.2-0-installer.run is downloaded partially before. Run the following command to complete the partial download of xampp installer file.

$ wget -c https://www.apachefriends.org/xampp-files/7.2.2/
xampp-linux-x64-7.2.2-0-installer.run

Example-4: `wget` command with -O option

-O option is used with `wget` command to store the downloaded file with different name. The following command will download the file, google-chrome-stable_current_amd64.deb with the name, chrome.deb.

$ wget –O chrome.deb https://dl.google.com/linux/direct/
google-chrome-stable_current_amd64.deb

Conclusion

The uses of different options of `wget` command are explained in this tutorial by using different examples. If the user facing any problem to use `wget` command for downloading any file, then this tutorial will help them to solve the problems.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Bash uniq Command

Linux users need to create or read the text file in regular basis for many purposes. A text file can contain different...
29/12/2020

Bash Head and Tail Command Tutorial

Many types of commands are available in bash to show the content a file. Most commonly used commands are ‘cat’,...
29/12/2020

BASH While Loop Examples

Three types of loops are used in bash programming. While loop is one of them. Like other loops, while loop is used to do...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024