If you have adhered to the Linux terminal, the state on a worker, how would you download a document from the terminal?
There is no download command in Linux except for there are two or three Linux commands for downloading records.
In this terminal stunt, you’ll learn two different ways to download documents utilizing the command line in Linux.
We are utilizing Ubuntu here yet separated from the establishment, the rest of the commands are similarly substantial for all other Linux circulations.
Download files from Linux terminal using wget command
wget is maybe the most utilized command-line download director for Linux and UNIX-like frameworks. You can download a solitary record, different documents, a whole index, or even a whole site utilizing wget.
wget is non-intuitive and can without much of a stretch work out of sight. This implies you can undoubtedly utilize it in contents or even form devices like uGet download director.
We should perceive how to utilize wget to download records from the terminal.
Most Linux dispersions accompany wget preinstalled. It is additionally accessible in the store of most appropriations and you can without much of a stretch install it utilizing your dissemination’s bundle chief.
On Ubuntu and Debian based dispersion, you can utilize the adept bundle supervisor order:
sudo apt install wget
Download a file or webpage using wget
You simply need to give the URL of the document or site page. It will download the record with its unique name in the catalog you are in.
To download different documents, you’ll need to spare their URLs in a book record and give that text document as a contribution to wget like this:
wget – i download_files.txt
Download files with a different name using wget
You’ll see that a page is quite often spared as index.html with wget. It will be a smart thought to give a custom name to the downloaded record.
You can utilize the – O (capitalized O) alternative to give the yield filename while downloading.
wget – O filename URL
Download a folder using wget
Assume you are perusing an FTP server and you have to download a whole index, you can utilize the recursive choice
wget – r ftp://server-address.com/directory
Download an entire website using wget
Truly, you can thoroughly do that. You can reflect a whole site with wget. By downloading a whole site we mean the whole open confronting site structure.
While you can utilize the mirror alternative – m legitimately, it will be a smart thought include:
- convert-links: links are changed over so inward links are highlighted downloaded asset rather than web
- page-requisites: downloads extra things like templates with the goal that the pages look better disconnected
wget – m – convert-links – page-imperatives website_address
Bonus Tip: Resume incomplete downloads
If you prematurely ended the download by squeezing C for certain reasons, you can continue the past download with an alternative – c.
wget – c
Download files from Linux command line using curl
Like wget, curl is likewise one of the most well-known orders to download records in Linux terminal. There are endless approaches to utilize curl widely yet we will zero in on just the basic downloading here.
Even though curl doesn’t come preinstalled, it is accessible in the official vaults of most dispersions. You can utilize your appropriation’s bundle administrator to install it.
To install curl on Ubuntu and other Debian based appropriations, utilize the accompanying order:
sudo apt install curl
Download files or webpage using curl
If you use curl with no alternative with a URL, it will peruse the record and print it on the terminal screen.
To download a record utilizing curl order in Linux terminal, you’ll need to utilize the – O (capitalized O) choice:
curl – O URL
It is less complex to download various documents in Linux with curl. You simply need to indicate various URLs:
curl – O URL1 URL2 URL3
Remember that curl isn’t as straightforward as wget. While wget spares website pages as index.html, curl will whine of distant record not having a name for site pages. You’ll need to spare it with a custom name as portrayed in the following area.
Download files with a different name
It could be befuddling however to give a custom name to the downloaded record (rather than the first source name), you’ll need to utilize – o (lowercase O) alternative:
curl – o filename URL
Now and then, curl wouldn’t simply download the record as you anticipate that it should. You’ll need to utilize choice – L (for the area) to download it accurately. This is because a few times the connections divert to some other connection and with an alternative – L, it follows the last connection.
Pause and resume download with curl
Like wget, you can likewise continue a stopped download utilizing curl with a choice – c:
curl – c URL
As usual, there are numerous approaches to do something very similar in Linux. Downloading documents from the terminal is the same.
wget and curl are only two of the most famous orders for downloading documents in Linux. There are all the more such order line instruments. Terminal based internet browsers like links, w3m, and so forth can likewise be utilized for downloading documents in the order line.
By and by, for a simple download, some incline toward utilizing wget over curl. It is easier and less befuddling because you may struggle to sort out why curl couldn’t download a document in the normal arrangement.