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

How to compare strings in Bash

For different programming purposes, we need to compare the value of two strings. Built-in functions are used in many programming...
28/12/2020

30 Bash Script Examples

Bash scripts can be used for various purposes, such as executing a shell command, running multiple commands together, customizing...
28/12/2020

NFS Server and Client Installation on CentOS 7

1 Preliminary Note I have fresh installed CentOS 7 server, on which I am going to install the NFS server. My CentOS server...
01/11/2021
Bài Viết

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

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024