List of content you will read in this article:
Linux is the most versatile operating system, providing several commands to ease your manual effort of scrolling through the entire system. You can get your work done from a single interface called a command-line terminal that is easy to access and learn. Like Windows operating system, you will also need to install software from the internet. But on Linux, you can hit the command to get this done.
“Wget” is the command that will help you with the download of specific files from the web. It is available as a free tool that supports HTTP, HTTPS, and FTP protocols, making it easier to download any type of file available on the internet. This command only works in the background, thus considered the non-interactive command. After executing this command, the user can disconnect from the system, as the work will be done in the background.
This command proves beneficial when you have to download the file from a slow or unstable network. If the network disconnects during the download, the command will automatically resume once the network connects again.
But, there could be some reasons that result in the failure of this command and displaying an error message as:
“–bash:wget:command not found”
This error specifies that the “wget” utility is not present on your Linux system or not responding as expected. You can go through this article to resolve this issue on your Ubuntu system.
It is the most commonly used utility. Before you start using this utility, make sure you have it installed. This command comes with the following syntax.
wget [option] [URL]
Both the parameters- option and URL- are optional in the above syntax. This utility comes with several options ensuring different functionality. The available options are -V or –version, -h or –help, -b or –background, and -e or –execute. URL specifies the location from where you want to download the specific file. Below we have mentioned the usage of some of these options.
Check `wget` command is installed or not.
To get the expected output of this command, you first need to ensure that your system has this utility installed. Running the following command will also provide you with the installed version of “wget” details. If the utility is not present, you will get the error.
$ wget –V
You will see which version of “wget” you have on your system in the below image.
Install the wget command on Ubuntu
If you do not have the “wget” utility on your system, you can imple it by executing the below-mentioned simple command via the command line.
$ sudo apt-get install wget
Once you are done with the installation process, check the installed version using the previous command. To get the detailed output of the “wget” command, you can use the “-h” option below.
$ wget -h
Using the “wget” command without any option
In the below example, we are using the “wget” command to download the index.html file from the site. The downloaded file will be stored in the current working directory. You can execute the ‘ls’ command to check if the HTML file is created or not in the current directory.
$ wget https://linuxhint.com
Using the `wget` command with -b option
If you want to complete the download process in the background, you can use the :-b” option and the “wget” command. The below-mentioned command will download the emp.zip file from the site in the background.
$ wget -b https://fahmidasclassroom.com/temp.zip
Using the `wget` command with the -c option.
If you want to complete the pending download, you can use the “c” option along with the “wget” command. The “wget” utility allows you to resume the pending download. If any download is incomplete due to a slow network, you can use the “wget” command to resume the download using the “-” option.
In the below example, we are resuming the download of file xampp-Linux-x64-7.2.2-0-installer.run. You can execute the following command to complete the partial download of xampp installer file.
$ wget -c https://www.apachefriends.org/xampp-files/7.2.2/
Using the `wget` command with -O option
If you want to store the downloaded file with another name, you can use the “-O” option along with the “wget” command. Execute the following command to download the file
google-chrome-stable_current_amd64.deb with the different name, chrome.deb.
$ wget –O chrome.deb https://dl.google.com/linux/direct/
Linux comes with several useful utilities helping you with tasks. “Wget” is also a utility allowing you to download files from the internet. Even you can use it to resume the pending downloads. In this article, you get to know how different “wget” options work. You can use them efficiently—all you have to do is ensure that this utility is installed on your system to work smoothly. Also, if you have an outdated version, update it before using it.
People also read: