Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the js_composer domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/holhol2/public_html/wp-includes/functions.php on line 6121

How To Use the wget Command in Linux

By holhol24 | April 9, 2024
wget-command-in-linux

Data transmission is one of the most invaluable tasks in today’s internet world. Although numerous tools are available on the web to download files, Linux is one step ahead. The wget utility in Linux is a simple, powerful, and proficient tool for downloading files using download links.

The wget command includes various features, such as resuming interrupted downloads, speed and bandwidth customization, encrypted downloads, and simultaneous file downloads. Moreover, it can interact with Rest APIs. So, in this brief tutorial, we will cover all the ways to use the wget command in Linux.

How To Use the wget Command in Linux

Whether you need a single file or want to download the entire file set, the wget utility helps you achieve both tasks. It also offers a few options to tweak its overall functioning. The standard wget command lets you download a file from a website. For example, to download jquery-3.7.1.js from its official website, please use the wget command:

wget https://code.jquery.com/jquery-3.7.1.js

wget-command-in-linux

The wget command, by default, saves the downloaded files in the current directory with their original names listed on the website. However, you can save it at a specific location or with a particular name through the ‘-O’ option. For instance, you can use the below wget command to save the above file with the name JavaScript.js:

wget -O JavaScript.js https://code.jquery.com/jquery-3.7.1.js

o-option-in-wget-commando-option-in-wget-command

Similarly, to download the file at another path without changing the current directory, please mention the new file path along with the desired filename:

wget -O ~/Downloads/JavaScript.js https://code.jquery.com/jquery-3.7.1.js

download-the-file-on-specific-location-using-wget-commanddownload-the-file-on-specific-location-using-wget-command

If your download fails, you can resume it from where it left off using the ‘–continue’ or ‘-c’ option:

wget -c https://code.jquery.com/jquery-3.7.1.js

c-option-in-wget-commandc-option-in-wget-command

While downloading a file, if you’re also performing other online tasks that require sufficient internet bandwidth, use the ‘-limit-rate’ option to limit its speed.

wget –limit-rate=50k https://code.jquery.com/jquery-3.7.1.js

putting-download-limit-using-wget-commandputting-download-limit-using-wget-command

Here, ’50k’ means limiting the speed to 50KB/s for the specified file. However, you can replace it with your desired limit. This is usually helpful when you do not want the wget command to consume all available bandwidth.

The most powerful feature of the wget utility is its ability to download entire websites recursively. You can use the ‘-r’ or ‘–recursive’ option to download all HTML pages, linked files, CSS, and images. For example:

wget -r https://code.jquery.com/jquery-3.7.1.js

r-option-in-wget-commandr-option-in-wget-command

Conclusion

The wget command is a powerful and versatile tool for downloading files from URLs. This brief tutorial explains how to use the wget command and its applications. Its prominent feature is recursive website download, but it also allows renaming downloaded files and resuming uninterrupted downloads. Moreover, if you have a low bandwidth, use the ‘–limit-rate’ option to limit the download speed.

holhol24

I am a Linux server pro admin and enthusiast, an upcoming web developer, junior php developer. I am currently a content creator for Holhol24, I love to play with Linux and all other distributions of it. I loves working with computers and strongly believes in sharing knowledge. Follow me For more insight into what is happening in Tech.

Advertisement Share: Facebook Twitter WhatsApp

Deprecated: File Theme without comments.php is deprecated since version 3.0.0 with no alternative available. Please include a comments.php template in your theme. in /home/holhol2/public_html/wp-includes/functions.php on line 6121

Leave a Reply

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