

{"id":110413,"date":"2022-09-12T09:00:21","date_gmt":"2022-09-12T03:30:21","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=110413"},"modified":"2022-09-12T09:47:01","modified_gmt":"2022-09-12T04:17:01","slug":"wget-command-in-linux","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/","title":{"rendered":"Wget Command in Linux"},"content":{"rendered":"<p>In this article, we will be going through, what WGET is, a brief history of it, its features, how to install it, the syntax, and options used with the Wget command in linux. In the end, we will also be looking at some beautiful examples of the wget command in action in the terminal. So buckle up, pay attention, and read right till the end!<\/p>\n<h3>What is Linux WGET?<\/h3>\n<p>WGET is a command-line-based utility in Linux-based operating systems that downloads files from the web. Using the wget command, you can download files using the FTP, HTTPS, and HTTP protocols.<\/p>\n<p>We have come across ourselves downloading content from the web, this process can sometimes be quite cumbersome, the wget tool is a robust computer program that retrieves files from web servers.<\/p>\n<p>The name of wget is derived from WWW (World wide web) and \u2018get\u2019. Using a wide range of options with the wget command, you can perform tasks like download multiple files, resume downloads, download in the background, mirror a website, limit the bandwidth, recursive downloads, and so much more.<\/p>\n<p>The wget tool was a part f the GNU project. Apart from Linux-based operating systems, it has also been ported to other operating systems like Microsoft Windows, macOS, OpenVMS, AmigaOS, Solaris, and HP-UX.<\/p>\n<h3>History of the WGET utility<\/h3>\n<p>The wget command appeared right in time when the internet was booming in 1966. The wget tool is based on another program called \u201cGETURL\u201d. Both the applications were written, designed, and developed by Hrvoje Nik\u0161i\u0107 along with the contributions of many, including Dan Harkless, Ian Abbott, and Mauro Tortonesi.<\/p>\n<p>GetURL was later changed to wget, as Hrvoje Nik\u0161i\u0107 became aware that there was already another amiga program with the name \u2018geturl\u2019, written by James Burton.<\/p>\n<p>Wget Was welcomed with open arms by the public as it helped bridge the gap in the inconsistent web-downloading software available at that time. In the mid-1990s, there was not a single program that could reliably use HTTP and FTP protocols.<\/p>\n<h3>Features of Linux Wget Command<\/h3>\n<p>Before we go practical, let us finish the practical part of the command, by discussing some of its most appreciated features.<\/p>\n<h4>1. Robustness<\/h4>\n<p>Wget was designed to be extremely robust over unstable and slow network connections. For example, if a download does not complete due to some network issue, wget will automatically try to continue from where it left off.<\/p>\n<h4>2. Recursive download<\/h4>\n<p>Wget has the capability to work as a web crawler and extract resources linked from HTML pages and also download them sequentially. It repeats the process recursively until all the pages have been downloaded or the maximum recursion depth is reached.<\/p>\n<h4>3. Non-interactiveness<\/h4>\n<p>Interactiveness here means, that wget does not require the interaction of the user and does not need to control a TTY. In fact, it is so non-interactive, that you can start wget and log off! This is highly in contrast with other graphical or text user interface web browsers, which require the user to stay online and manually restart failed downloads.<\/p>\n<h4>4. Portability<\/h4>\n<p>The wget tool is written in portable C, a highly portable style of C with minimal dependencies on third-party libraries. We have already seen that wget is ported on numerous other environments like Microsoft Windows, macOS, OpenVMS, AmigaOS, Solaris, and HP-UX. It is also available as one of the GnuWin packages in the native Microsoft Windows program.<\/p>\n<p>Wget also has many other features like:<\/p>\n<p>1. Supports download through proxies.<\/p>\n<p>2. Makes use of persistent HTTP connections when available.<\/p>\n<p>3. Supports IPv6 on systems with appropriate interfaces.<\/p>\n<p>4. SSL\/TLS is supported for encrypted downloads using OpenSSL.<\/p>\n<p>5. Files larger than 2GiB are supported on 32-but systems.<\/p>\n<p>6. Saves output in the web archiving standard WARC format.<\/p>\n<p>And so many more!<\/p>\n<h3>Installing wget<\/h3>\n<p>The wget command does not come pre-installed in all the Linux distributions, if you are not sure if your system has wget installed or not, simply type the command \u201cwget\u201d on your terminal, if you get a message saying \u201cwget: missing URL\u201d as shown below, you are good to go, as it is already installed in your system.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/checking-if-wget-is-installed.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110704\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/checking-if-wget-is-installed.webp\" alt=\"checking if wget is installed\" width=\"474\" height=\"165\" \/><\/a><\/p>\n<p>However, if you get the message \u201cwget command not found\u201d, you will have to install the wget tool, using the following commands with respect to your Linux distribution.<\/p>\n<h4>Installing wget in Debian based Linux distros<\/h4>\n<p>If you want to install wget on a Debian based Linux distribution like Ubuntu, Kali, Mint, Deepin, MX Linux, PureOS, AntiX, etc, use the command shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt install wget<\/pre>\n<h4>Installing wget in Fedora-based Linux distros<\/h4>\n<p>If you want to install wget on a Debian based Linux distribution like RHEl, Fedora spins, ClearOS, Qubes, etc, use the command shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt install wget<\/pre>\n<h3>Syntax of the wget command<\/h3>\n<p>The syntax of the wget command is as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Wget &lt;options&gt; &lt;URL&gt;<\/pre>\n<p>Let us look at the fields in the syntax to provide a better understanding:<\/p>\n<h4>1. &lt;options&gt;<\/h4>\n<p>This field accepts a range of options that specify hope wget should function and print the output.<\/p>\n<h4>2. &lt;URL&gt;<\/h4>\n<p>This field takes in the URL of the file or directory you want to download or synchronize.<\/p>\n<h3>Options used with the wget command<\/h3>\n<p>We saw that when we pair the wget command with the various option, we can do different tasks like downloading multiple files, resuming downloads, downloading in the background, mirroring a website, limiting the bandwidth, recursive downloads, and so much more. Let us take look at the list of available options with the wget command:<\/p>\n<h4>Logging in and input file options<\/h4>\n<h5>1. -o &lt;logfile&gt;<\/h5>\n<p>This option logs all the messages to the log file you specified. You can also write this option as \u201c&#8211;output-file\u201d<\/p>\n<h5>2. -a<\/h5>\n<p>This option is the same as the option \u201c-o\u201d, except it \u2018appends\u2019 to the specified log file, instead of overwriting the entire old log file. You can also write this option as \u201c&#8211;append-output\u201d<\/p>\n<h5>3. -d<\/h5>\n<p>This option turns on debug output. It prints various information important to the developers of wget if it does not work properly. You can also write this option as \u201c&#8211;debug\u201d<\/p>\n<h5>4. -q<\/h5>\n<p>This option turns off the output of wget. You can also write this option as \u201c&#8211;quiet\u201d<\/p>\n<h5>5. -v<\/h5>\n<p>This option provides verbose to the output to provide a better understanding of what is happening. You can also write this option as \u201c&#8211;verbose\u201d<\/p>\n<h5>6. -nv<\/h5>\n<p>This option does not give verbose to the output. You can also write this option as \u201c&#8211;non-verbose\u201d<\/p>\n<h5>7. -i &lt;file&gt;<\/h5>\n<p>This option reads URLs from a local or external file. You can also write this option as \u201c&#8211;input-file\u201d<\/p>\n<h5>8. -F<\/h5>\n<p>This option forces the input file to be treated as an HTML file. You can also write this option as \u201c&#8211;force-html\u201d<\/p>\n<h5>9. -B &lt;url&gt;<\/h5>\n<p>This option resolves links using URL as the point of reference when reading links from an HTML file specified with the option \u201c-F\u201d. You can also write this option as \u201c&#8211;base\u201d<\/p>\n<h4>Download options<\/h4>\n<h5>1. &#8211;bind-address=&lt;address&gt;<\/h5>\n<p>This option binds to the specified address on the local machine when making a client TCP\/IP connection.<\/p>\n<h5>2. -t &lt;number&gt;<\/h5>\n<p>This option sets the number of retries. You can even specify \u2018inf\u2019 for infinite retries! You can also write this option as \u201c&#8211;tries\u201d<\/p>\n<h5>3. -c<\/h5>\n<p>This option continues getting a partially downloaded file. You can also write this option as \u201c&#8211;continue\u201d<\/p>\n<h5>4. &#8211;progress = &lt;type&gt;<\/h5>\n<p>This option selects the progress bar style, you can either specify \u201cdot\u201d or \u201cbar\u201d.<\/p>\n<h5>5. -N<\/h5>\n<p>This option turns on timestamping. You can also write this option as \u201c&#8211;timestamping\u201d<\/p>\n<h5>6. &#8211;no-use-server-timestamps<\/h5>\n<p>This option does not set the local file\u2019s timestamp to the one on the server.<\/p>\n<h5>7. -S<\/h5>\n<p>This option prints the header sent by HTTP servers and responses sent by FTP servers. You can also write this option as \u201c&#8211;server-response\u201d<\/p>\n<h5>8. &#8211;spider<\/h5>\n<p>This option makes wget behave as a web spider, meaning it does not download the pages and only checks that they are there.<\/p>\n<h5>9. -T &lt;secoinds&gt;<\/h5>\n<p>This option sets the network timeout to the number of seconds you specify. You can also write this option as \u201c&#8211;timeout\u201d<\/p>\n<h5>10. &#8211;dns-timeout = &lt;seconds&gt;<\/h5>\n<p>This option sets the DNS lookup timeout to the number of seconds you specify.<\/p>\n<h4>Directory options<\/h4>\n<h5>1. -nd<\/h5>\n<p>This option does not create a hierarchy of directories when retrieving recursively. You can also write this option as \u201c&#8211;no-directories\u201d<\/p>\n<h5>2. -x<\/h5>\n<p>This option is the exact opposite of the option \u201c-nd\u201d. It creates a hierarchy of directories, even if one would not be created otherwise. You can also write this option as \u201c&#8211;force-directories\u201d<\/p>\n<h5>3. -nh<\/h5>\n<p>This option disables the generation of host-prefixed directories. You can also write this option as \u201c&#8211;no-host-directories\u201d<\/p>\n<h5>4. &#8211;protocol directories<\/h5>\n<p>This option uses the protocol name as a directory component of local file names.<\/p>\n<h5>5. &#8211;cut-dirs=&lt;number&gt;<\/h5>\n<p>This option ignores the number of directory components. It is useful for getting a fine-grained control over the directory when recursive retrieval is used<\/p>\n<h4>HTTP options<\/h4>\n<h5>1. -E<\/h5>\n<p>This option appends the suffix \u201c.html\u201d to the name of the local file if a file of type application\/xhtml+xml or text\/html is downloaded and the URL does not end with the regexp &#8220;\\.[Hh][Tt][Mm][Ll]?&#8221;. You can also write this option as \u201c&#8211;html-extension\u201d<\/p>\n<h5>2. &#8211;http-user=user \/ &#8211;http-passwd<\/h5>\n<p>This option specifies the user and password on an HTTP server.<\/p>\n<h5>3. &#8211;no-cache<\/h5>\n<p>This option disables the server-side cache.<\/p>\n<h5>4. &#8211;no-cookies<\/h5>\n<p>This option disables the use of cookies.<\/p>\n<h5>5. &#8211;load-cookies &lt;file&gt;<\/h5>\n<p>This option loads cookies from the specified file before the first HTTP retrieval file.<\/p>\n<h5>6. &#8211;save-cookies<\/h5>\n<p>This option saves cookies to the specified file before exiting.<\/p>\n<h5>7. &#8211;keep-session-cookies<\/h5>\n<p>This option causes the option \u201c&#8211;save-cookies\u201d to also save session cookies.<\/p>\n<h5>8. -header=&lt;header line&gt;<\/h5>\n<p>This option sends the header line you specify with the rest of the headers in each HTTP request<\/p>\n<h5>9. &#8211;max-redirect=&lt;number&gt;<\/h5>\n<p>This option specifies the maximum number of redirections to follow for a resource. If you do not specify any value, it takes the default value as 20.<\/p>\n<h5>10. &#8211;auth-no-challenge<\/h5>\n<p>This option sends basic HTTP authentication information for all the requests like wget 1.10.2 and prior did by default.<\/p>\n<h5>11. -V<\/h5>\n<p>This option prints the information about the version of the wget command.<\/p>\n<p>PHEW!! Are we done? well, those don\u2019t even scratch the surface of the list of options available with the wget command. These are just some of the most frequently used commands with the wget command. If you are really interested in learning more about the options, you can use the command \u201cwget -h\u201d, which prints an immensely long list of options as shown:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/help-menu-of-the-wget-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110705\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/help-menu-of-the-wget-command.webp\" alt=\"help menu of the wget command\" width=\"772\" height=\"892\" \/><\/a><\/p>\n<p>NOTE: this is only a fraction of the help menu!<\/p>\n<p>Now that we have grasped our fundamentals, let us look at some practical command of the whet command in the terminal.<\/p>\n<h3>Downloading a file with wget<\/h3>\n<p>If you want to simply download a file with the wget command, simply use iot with no options as shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget &lt;URL&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-a-file-with-wget.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110706\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-a-file-with-wget.webp\" alt=\"downloading a file with wget\" width=\"780\" height=\"219\" \/><\/a><\/h3>\n<h3>Downloading a file with a different name<\/h3>\n<p>To download the same file but with a different name, pair the wget command with the option \u201c-O\u201d followed by the new name as shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget -O &lt;name&gt; &lt;URL&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-a-file-with-a-different-name.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110707\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-a-file-with-a-different-name.webp\" alt=\"downloading a file with a different name\" width=\"780\" height=\"221\" \/><\/a><\/h3>\n<h3>Downloading multiple files with HTTP and FTP protocol<\/h3>\n<p>If you want to download multiple files using HTTP and FTP protocols, simply use the wget command with no options followed by the URLs separated by a space as shown below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-multiple-files-with-http-and-ftp-protocol.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110708\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-multiple-files-with-http-and-ftp-protocol.webp\" alt=\"downloading multiple files with http and ftp protocol\" width=\"780\" height=\"505\" \/><\/a><\/p>\n<h3>Downloading multiple files from a file<\/h3>\n<p>Say you have about 10 URLs and you want to retrieve content from all of these files, It would be really tedious and unprofessional to follow the previous method and write the 10 URLs side by side in the terminal.<\/p>\n<p>Instead, you can write all of these URLs in a \u201d.txt\u201d file and simply use the option \u201c-i\u201d followed by the name of the file that contains these URLs as shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget -i &lt;filename&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/text-file-that-contains-links.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110710\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/text-file-that-contains-links.webp\" alt=\"text file that contains links\" width=\"780\" height=\"116\" \/><\/a><\/h3>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-multiple-files-from-a-file-1.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110709\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-multiple-files-from-a-file-1.webp\" alt=\"downloading multiple files from a file\" width=\"780\" height=\"218\" \/><\/a><\/h3>\n<h3>Downloading multiple within a range<\/h3>\n<p>Suppose you need to download similar URLs that only have a change in number, you can simply specify the range from where to where to want to download a shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget &lt;url{n1..n2}&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-multiple-files-within-a-range.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110711\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-multiple-files-within-a-range.webp\" alt=\"downloading multiple files within a range\" width=\"780\" height=\"552\" \/><\/a><\/h3>\n<h3>Resume an incomplete download<\/h3>\n<p>Wget also has the option to pause a download, we can do so by pressing \u201cctrl\u201d + \u201cc\u201d. We know that using wget, we can resume a paused download, nu how? Well, we simply pair the wget command with the option \u201c-c\u201d and it will pick up the download exactly where you left off as shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget -c &lt;URL&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/resuming-an-uncompleted-download.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110712\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/resuming-an-uncompleted-download.webp\" alt=\"resuming an uncompleted download\" width=\"748\" height=\"606\" \/><\/a><\/h3>\n<h3>Mirroring an entire website<\/h3>\n<p>If you want to download an entire website for offline viewing, use the command shown in the output below. This command will make a local copy of the website along with other assets like CSS, images, Javascript and more<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/mirroring-an-entire-website.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110713\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/mirroring-an-entire-website.webp\" alt=\"mirroring an entire website\" width=\"780\" height=\"800\" \/><\/a><\/p>\n<h3>Downloading in background<\/h3>\n<p>If you want your download to happen in the background simply pair the wget command with the option \u201c-b\u201d followed by the filename you want to save it in a shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget -b &lt;url&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-in-background.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110714\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-in-background.webp\" alt=\"downloading in background\" width=\"780\" height=\"89\" \/><\/a><\/h3>\n<h3>Specifying download speed limit<\/h3>\n<p>To specify the download speed limit, you can use the option \u201c&#8211;limit-rate\u201d a shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget -c --limit-rate=&lt;n&gt; &lt;url&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/specifying-download-speed-limit.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110715\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/specifying-download-speed-limit.webp\" alt=\"specifying download speed limit\" width=\"780\" height=\"87\" \/><\/a><\/p>\n<p>For example, the command shown in the above output will restrict the download speed limit to 100K and the logs will be created under the file \u201cwget.log\u201d. Now we can check the download speed of wget using the command shown below:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/checking-download-speed-limit.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110716\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/checking-download-speed-limit.webp\" alt=\"checking download speed limit\" width=\"729\" height=\"893\" \/><\/a><\/p>\n<h3>Ignoring the SSL certificate check<\/h3>\n<p>If you want to ignore the SSL certificate check while downloading files via HTTPS pair the wget command with the option \u201c&#8211;no-check-certificate\u201d as shown:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget --no-check-certificate &lt;url&gt;<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/ignoring-the-ssl-certificate-check.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110717\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/ignoring-the-ssl-certificate-check.webp\" alt=\"ignoring the ssl certificate check\" width=\"780\" height=\"260\" \/><\/a><\/p>\n<h3>Downloading password protected files via FTP and HTTP<\/h3>\n<p>Use the options \u201c&#8211;ftp-user=&lt;username&gt;\u201d and \u201c&#8211;ftp-password=&lt;password&gt;\u201d If you want to download a file from a password-protected FTP server, as shown in the syntax below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget --ftp-user=narad --ftp-password=password ftp:\/\/ftp.example.com\/filename.tar.gz<\/pre>\n<p>Use the options \u201c&#8211;http-user=&lt;username&gt;\u201d and \u201c&#8211;http-password=&lt;password&gt;\u201d If you want to download a file from a password-protected FTP server, as shown in the syntax below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wget --http-user=narad --http-password=password ftp:\/\/http.example.com\/filename.tar.gz<\/pre>\n<h3>Downloading to the standard output<\/h3>\n<p>In the command shown below, the whet command will quietly download and print the output in the latest WordPress version to standard output. Since we piped this output to the tar utility, it extracts and archives it to the \/home\/gopikiran\/Desktop directory<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Wget -q -o - &lt;url&gt;<\/pre>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-to-the-standard-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110718\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/08\/downloading-to-the-standard-output.webp\" alt=\"downloading to the standard output\" width=\"780\" height=\"50\" \/><\/a><\/h3>\n<h3>More options used with the wget command!!<\/h3>\n<p>We have already seen a truckload of options, yet before we call it a day, let us look at another truckload of options:<\/p>\n<h4>HTTPS (SSL\/TLS) options<\/h4>\n<h5>1. &#8211;secure-protocol<\/h5>\n<p>This option chooses the secure protocol to be used.<\/p>\n<h5>2. &#8211;no-check-certificate<\/h5>\n<p>This option does not check the server certificate against the available certificate authorities.<\/p>\n<h5>3. &#8211;certificate<\/h5>\n<p>This option uses the client certificate stored in the file.<\/p>\n<h5>4. &#8211;certificate-type<\/h5>\n<p>This option specifies the type of the client certificate. You can enter Legal values like PEM and DER, also known as ASN1.<\/p>\n<h5>5. &#8211;private key<\/h5>\n<p>This option allows you to provide the private key in a file separate from the certificate.<\/p>\n<h5>6. &#8211;private -key-type<\/h5>\n<p>This option specifies the type of the private key.<\/p>\n<h5>7. &#8211;ca-certificate<\/h5>\n<p>This option uses the file you specified with the bundle of certificate authorities (&#8220;CA&#8221;) to verify the peers.<\/p>\n<h5>8. &#8211;ca-directory<\/h5>\n<p>This option specifies a directory containing CA certificates in PEM format.<\/p>\n<h5>9. &#8211;random-file<\/h5>\n<p>This option uses the file you specified as the source of random data for seeding the pseudorandom number generator on systems without \/dev\/random.<\/p>\n<h5>10. &#8211;edg-file<\/h5>\n<p>This option uses the file you specified as the EGD socket, where EGD stands for Entropy Gathering Daemon, a user-space program that collects data from various unpredictable system sources and makes it available to other programs that might need it.<\/p>\n<h4>FTP options<\/h4>\n<h5>1. &#8211;ftp-user<\/h5>\n<p>This option specifies the username user and password on an FTP server.<\/p>\n<h5>2. &#8211;no-remove-listing<\/h5>\n<p>This option does not remove the temporary \u201c.listing\u201d files generated by FTP retrievals.<\/p>\n<h5>3. &#8211;no-glob<\/h5>\n<p>This option turns of FTP globbing, where globbing refers to the use of shell-like special characters , like *, ?, [ and ] to retrieve more than one file from the same directory.<\/p>\n<h5>4. &#8211;no-passive-ftp<\/h5>\n<p>This option disables the use of the passive FTP transfer mode.<\/p>\n<h4>Recursive retrieval options<\/h4>\n<h5>1. -r<\/h5>\n<p>This option turns on recursive retrieving. You can also write this option as \u201c&#8211;recursive\u201d<\/p>\n<h5>2. -I<\/h5>\n<p>This option specifies recursion maximum depth level depth. By default, the maximum depth is 5.<\/p>\n<h5>3. &#8211;delete-after<\/h5>\n<p>This option tells wget to delete every single file it downloads, after having done so.<\/p>\n<h5>4. -k<\/h5>\n<p>This option converts the links in the document to make them suitable for local viewing after the download is complete.<\/p>\n<h5>5. -K<\/h5>\n<p>This option backs up the original version with an .orig suffix. Affects the behavior of \u201c-N\u201d When converting a file.<\/p>\n<h5>6. -m<\/h5>\n<p>This option turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings.<\/p>\n<h5>7. -p<\/h5>\n<p>This option causes wget to download all the files that are necessary to properly display a given HTML page.<\/p>\n<h5>8. &#8211;strict-comments<\/h5>\n<p>This option turns on strict parsing of HTML comments.<\/p>\n<h4>Recursive accept\/reject options<\/h4>\n<h5>1. -A \/ -R<\/h5>\n<p>This option specifies comma-separated lists of file name suffixes or patterns to accept or reject.<\/p>\n<h5>2. -D<\/h5>\n<p>This option sets domains to be followed. You can also write this option as \u201c&#8211;domains\u201d<\/p>\n<h5>3. &#8211;exclude domains<\/h5>\n<p>This option specifies the domains that are not to be followed.<\/p>\n<h5>4. &#8211;follow-ftp<\/h5>\n<p>This option follows FTP links from HTML documents. If it is not specified wget ignores all the FTP links.<\/p>\n<h5>5. &#8211;ignore-tags<\/h5>\n<p>This option wget ignores all the FTP links, use it to kip certain HTML tags when recursively looking for documents to download<\/p>\n<h5>6. -H<\/h5>\n<p>This option enables spanning across hosts when doing recursive retrieving.<\/p>\n<h5>7. -L<\/h5>\n<p>This option Follow relative links only. You can also write this option as \u201c&#8211;relative\u201d.<\/p>\n<h5>8. -I<\/h5>\n<p>This option specifies a comma-separated list of directories you want to follow when downloading.<\/p>\n<h5>9. -X<\/h5>\n<p>This option specifies a comma-separated list of directories you want to exclude from download.<\/p>\n<h5>10. -np<\/h5>\n<p>This option does not ever ascend to the parent directory when retrieving recursively.<\/p>\n<h3>Files used by wget<\/h3>\n<p>There are only 2 files used by the wget command. One is \u201c\/etc\/wgetrc\u201d, from where it obtains the default location of the global startup file, and second is \u201c.wgetrc\u201d, from which it obtains the user-startup file.<\/p>\n<h3>Summary<\/h3>\n<p>As you have seen the wget command is a not so simple yet very helpful tool with so many features. As we combine it with its many options, we can perform tasks like download multiple files, resume downloads, download in the background, mirror a website, limit the bandwidth, recursive downloads, and so much more.<\/p>\n<p>You have now learned what wget is, a brief history of it, its features, how to install it, syntax, options, and some practical examples of the wget command in the terminal.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will be going through, what WGET is, a brief history of it, its features, how to install it, the syntax, and options used with the Wget command in linux. In&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":110612,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[27079,27080,27078],"class_list":["post-110413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux-wget-example","tag-syntax-of-linux-wget-command","tag-wget-command-in-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Wget Command in Linux - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn what is linux WGET command, its features, history, installation, syntax, and options used with the Wget command with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wget Command in Linux - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn what is linux WGET command, its features, history, installation, syntax, and options used with the Wget command with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-12T03:30:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-12T04:17:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/wget-command-in-linux.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wget Command in Linux - DataFlair","description":"Learn what is linux WGET command, its features, history, installation, syntax, and options used with the Wget command with examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"Wget Command in Linux - DataFlair","og_description":"Learn what is linux WGET command, its features, history, installation, syntax, and options used with the Wget command with examples.","og_url":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2022-09-12T03:30:21+00:00","article_modified_time":"2022-09-12T04:17:01+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/wget-command-in-linux.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Wget Command in Linux","datePublished":"2022-09-12T03:30:21+00:00","dateModified":"2022-09-12T04:17:01+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/"},"wordCount":3026,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/wget-command-in-linux.webp","keywords":["linux wget example","syntax of linux wget command","Wget Command in Linux"],"articleSection":["Linux Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/","url":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/","name":"Wget Command in Linux - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/wget-command-in-linux.webp","datePublished":"2022-09-12T03:30:21+00:00","dateModified":"2022-09-12T04:17:01+00:00","description":"Learn what is linux WGET command, its features, history, installation, syntax, and options used with the Wget command with examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/wget-command-in-linux.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/wget-command-in-linux.webp","width":1200,"height":628,"caption":"wget command in linux"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/wget-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Linux Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"Wget Command in Linux"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/110413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=110413"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/110413\/revisions"}],"predecessor-version":[{"id":110719,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/110413\/revisions\/110719"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/110612"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=110413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=110413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=110413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}