{"id":20135,"date":"2022-12-27T09:51:01","date_gmt":"2022-12-27T09:51:01","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=20135"},"modified":"2023-10-23T10:02:59","modified_gmt":"2023-10-23T10:02:59","slug":"how-to-install-wget-on-ubuntu","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-wget-on-ubuntu\/","title":{"rendered":"How to Install wget on Ubuntu"},"content":{"rendered":"<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-1024x878.jpg\" alt=\"How to Install wget on Ubuntu\" width=\"1024\" height=\"878\" class=\"alignnone size-large wp-image-20136 lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-1024x878.jpg 1024w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-300x257.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-128x110.jpg 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-420x360.jpg 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-540x463.jpg 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-720x617.jpg 720w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-960x823.jpg 960w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-1140x977.jpg 1140w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-1166x999.jpg 1166w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-840x720.jpg 840w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu-1260x1080.jpg 1260w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/10\/How-to-Install-wget-on-Ubuntu.jpg 1400w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/878;\" \/><\/p>\n<p>When managing a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-are-web-servers-and-why-are-they-needed\/\">web server<\/a> or even just working on local development, there are certain tools that are indispensable.<\/p>\n<p>One such tool is wget. wget is a free utility available for Unix-like operating systems, which is used to download files from the internet. It supports downloading via HTTP, HTTPS, and FTP protocols. Whether you&#8217;re setting up a new server or just need to download a file quickly without a browser, wget is your go-to solution.<\/p>\n<p>In this guide, we&#8217;ll walk you through the steps to install wget on an <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-ubuntu-beginners-guide-ubuntu-linux-distro\/\">Ubuntu<\/a> system. By the end, you&#8217;ll have wget set up and ready to use. <\/p>\n<p>Let&#8217;s get started.<\/p>\n<h2>Step 1: Update Your System<\/h2>\n<p>Before installing any new software, it&#8217;s always a good practice to update your system&#8217;s package list. This ensures you&#8217;re getting the latest version and dependencies.<\/p>\n<pre>\r\nsudo apt update\r\n<\/pre>\n<h2>Step 2: Install wget<\/h2>\n<p>Once your system is updated, you can proceed to install wget.<\/p>\n<pre>\r\nsudo apt install wget\r\n<\/pre>\n<p>This command will install wget and any necessary dependencies. The system might ask for confirmation; press Y and then Enter to continue.<\/p>\n<h2>Step 3: Verify the Installation<\/h2>\n<p>After the installation is complete, you can verify that wget was installed correctly.<\/p>\n<pre>\r\nwget --version\r\n<\/pre>\n<p>This command should display the version of wget that was installed, confirming that the installation was successful.<\/p>\n<p>For example:<\/p>\n<pre>\r\ndimitri@webhostinggeeks:~# wget --version\r\nGNU Wget 1.19.4 built on linux-gnu.\r\n\r\n-cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls\r\n+ntlm +opie +psl +ssl\/openssl\r\n\r\nWgetrc:\r\n    \/etc\/wgetrc (system)\r\nLocale:\r\n    \/usr\/share\/locale\r\nCompile:\r\n    gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"\/etc\/wgetrc\"\r\n    -DLOCALEDIR=\"\/usr\/share\/locale\" -I. -I..\/..\/src -I..\/lib\r\n    -I..\/..\/lib -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_LIBSSL -DNDEBUG\r\n    -g -O2 -fdebug-prefix-map=\/build\/wget-Xb5Z7Y\/wget-1.19.4=.\r\n    -fstack-protector-strong -Wformat -Werror=format-security\r\n    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall\r\nLink:\r\n    gcc -DHAVE_LIBSSL -DNDEBUG -g -O2\r\n    -fdebug-prefix-map=\/build\/wget-Xb5Z7Y\/wget-1.19.4=.\r\n    -fstack-protector-strong -Wformat -Werror=format-security\r\n    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-Bsymbolic-functions\r\n    -Wl,-z,relro -Wl,-z,now -lpcre -luuid -lidn2 -lssl -lcrypto -lpsl\r\n    ftp-opie.o openssl.o http-ntlm.o ..\/lib\/libgnu.a \r\n<\/pre>\n<h2>Step 4: Basic wget Usage<\/h2>\n<p>Now that wget is installed, let&#8217;s go over some basic usage:<\/p>\n<pre>\r\nwget [URL]\r\n<\/pre>\n<p>Replace [URL] with the link to the file you wish to download. wget will then download the file to your current directory.<\/p>\n<h3>Example 1: Specify Download Directory<\/h3>\n<p>To download a file to a specific directory:<\/p>\n<pre>\r\nwget -P \/path\/to\/directory [URL]\r\n<\/pre>\n<h3>Example 2: Download Multiple Files<\/h3>\n<p>To download multiple files, you can create a text file with a list of URLs and use:<\/p>\n<pre>\r\nwget -i \/path\/to\/file.txt\r\n<\/pre>\n<h3>Example 3: Limit Download Speed<\/h3>\n<p>To limit the download speed to avoid consuming all available bandwidth:<\/p>\n<pre>\r\nwget --limit-rate=200k [URL]\r\n<\/pre>\n<p>This limits the download speed to 200 KB\/s.<\/p>\n<h3>Example 4: Resume Interrupted Downloads<\/h3>\n<p>If a download gets interrupted, you can resume it using:<\/p>\n<pre>\r\nwget -c [URL]\r\n<\/pre>\n<h3>Example 5: Download in the Background<\/h3>\n<p>To download a file in the background:<\/p>\n<pre>\r\nwget -b [URL]\r\n<\/pre>\n<h3>Example 6: Mirror a Website<\/h3>\n<p>To mirror or download an entire website for offline viewing:<\/p>\n<pre>\r\nwget --mirror --convert-links --adjust-extension --page-requisites --no-parent [website_URL]\r\n<\/pre>\n<h3>Example 7: Set Download Retry Attempts<\/h3>\n<p>To specify the number of retries if the download fails:<\/p>\n<pre>\r\nwget --tries=5 [URL]\r\n<\/pre>\n<p>This will retry the download 5 times.<\/p>\n<h3>Example 8: Download Files with a Specific Extension<\/h3>\n<p>To download only files with a specific extension from a website:<\/p>\n<pre>\r\nwget --recursive --no-parent --no-clobber --accept jpg,jpeg,png [website_URL]\r\n<\/pre>\n<p>This command will download only .jpg, .jpeg, and .png files.<\/p>\n<h3>Example 9: Avoid SSL Certificate Checks<\/h3>\n<p>If you&#8217;re downloading from a source with an untrusted SSL certificate and want to avoid SSL checks:<\/p>\n<pre>\r\nwget --no-check-certificate [URL]\r\n<\/pre>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">sudo apt update<\/span> \u2013 Updates the package list for your system.<\/li>\n<li><span class=\"fw-bold\">sudo apt install wget<\/span> \u2013 Installs wget and its dependencies.<\/li>\n<li><span class=\"fw-bold\">wget &#8211;version<\/span> \u2013 Displays the installed version of wget.<\/li>\n<li><span class=\"fw-bold\">wget [URL]<\/span> \u2013 Downloads the file from the specified URL.<\/li>\n<li><span class=\"fw-bold\">wget -P \/path\/to\/directory [URL]<\/span> \u2013 Specify download directory.<\/li>\n<li><span class=\"fw-bold\">wget -i \/path\/to\/file.txt<\/span> \u2013 Download multiple files.<\/li>\n<li><span class=\"fw-bold\">wget &#8211;limit-rate=200k [URL]<\/span> \u2013 Limit download speed.<\/li>\n<li><span class=\"fw-bold\">wget -c [URL]<\/span> \u2013 Resume interrupted downloads.<\/li>\n<li><span class=\"fw-bold\">wget -b [URL]<\/span> \u2013 Download in the background.<\/li>\n<li><span class=\"fw-bold\">wget &#8211;mirror &#8211;convert-links &#8211;adjust-extension &#8211;page-requisites &#8211;no-parent [website_URL]<\/span> \u2013 Mirror a website.<\/li>\n<li><span class=\"fw-bold\">wget &#8211;tries=5 [URL]<\/span> \u2013 Set download retry attempts.<\/li>\n<li><span class=\"fw-bold\">wget &#8211;recursive &#8211;no-parent &#8211;no-clobber &#8211;accept jpg,jpeg,png [website_URL]<\/span> \u2013 Download files with a specific extension.<\/li>\n<li><span class=\"fw-bold\">wget &#8211;no-check-certificate [URL]<\/span> \u2013 Avoid SSL certificate checks.<\/li>\n<\/ul>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Why do I need to update my system before installing wget?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">Updating your system ensures that you have the latest package lists and dependencies, which can prevent potential conflicts and ensure smooth installation of new software, including wget.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Can I use wget to download files from any website?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">Yes, wget can download files from any website that supports HTTP, HTTPS, or FTP. However, ensure you have the necessary permissions and are not violating any terms of service.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Is wget available for other operating systems?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">While wget is primarily designed for Unix-like systems, there are versions and alternatives available for Windows and other operating systems.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I specify a different directory for my downloads?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can use the &#8216;-P&#8217; prefix followed by the directory path to specify a different directory for your downloads. For example, &#8216;wget -P \/path\/to\/directory [URL]&#8217;.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Are there any security concerns with using wget?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">As with any tool, it&#8217;s essential to use wget responsibly. Avoid downloading files from untrusted sources, and always be cautious of potential security threats. Regularly updating wget ensures you have the latest security patches.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>Congratulations! You&#8217;ve successfully installed and learned the basics of using wget on Ubuntu.<\/p>\n<p>wget is an incredibly powerful tool with a wide range of functionalities. The examples provided above are just the tip of the iceberg when it comes to what wget can achieve. By mastering these commands, you can streamline and automate various tasks related to file downloads and website management. <\/p>\n<p>Always remember to use wget responsibly and ensure you have the necessary permissions when downloading or mirroring websites.<\/p>\n<p>If you&#8217;re in the market for hosting solutions, don&#8217;t forget to explore the <a href=\"https:\/\/webhostinggeeks.com\/best\/dedicated-hosting\/\">best dedicated servers<\/a> and <a href=\"https:\/\/webhostinggeeks.com\/best\/vps-hosting\/\">best VPS hosting<\/a> options. Happy downloading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When managing a web server or even just working on local development, there are certain tools that are indispensable. One such tool is wget. wget is a free utility available&#8230;<\/p>\n","protected":false},"author":6,"featured_media":20136,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1073],"tags":[1856,1924],"class_list":["post-20135","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-ubuntu","tag-wget"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/20135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=20135"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/20135\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/20136"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=20135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=20135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=20135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}