Check tutorial of Using cURL to Download Remote Files from the Command Line
So after a lot of requests from our users here is a guide about Using cURL to Download Remote Files from the Command Line.
The powerful curl command line utility can be used to download files from almost any remote server. Old command line users know that this can be useful for a wide variety of situations, but to keep it simple many will find that downloading a file with curl can often be a faster alternative to using a web browser or FTP client from the GUI side of Mac OS X (or linux). This is useful for local situations, but is especially valuable if you find yourself in a situation where you need to download something to a remote Mac when connected via SSH.
For the purposes of this walkthrough we will mainly focus on downloading files from the two commonly used HTTP and SFTP protocols, although it should be noted that cURL supports many more protocols. While curl is easy to use, it is recommended that you have some command line knowledge.
Download Exact Match files with curl -O
Using the uppercase -O flag with curl downloads the file from the remote server while keeping the exact file name, the basic syntax for this is the following:
This means that if the specified URL file is named “sample.zip”, it will be downloaded with the file name “sample.zip”, and if the file has a huge and complicated name, such as “LongExampleFileNameForOSXDaily-v-1- 3-51-revision- 515b12-readme.txt ”on the remote server, it will save with that exact name on the local machine. Longer file names are often better handled with the -o flag than -O, which we will discuss shortly .
Regular readers may remember that we used the curl -O command when explaining how to extract the actual audio content from an m3u streaming file.
When you start a download with curl, the percentage transferred, download time and time remaining, and transfer speed are displayed.
The screenshot provides a better rendering than the pasted example below, but looks something like this:
% Total% received% Xferd Average speed Time Time Time Current download Upload Total spent Links Speed 100 10505100 10505 0 0 79741 0 -: -: – -: -: – -: -: – 142k
With the transfer rate shown, you can redirect curl’s output to / dev / null and use it to test the speed of the internet connection, but the wget command has an easier to read and follow transfer bar, so wget is better suitable for that task.
Save an external file with a different name with curl -o
If you use a small -o flag, you can specify a different file name for the downloaded file than what it is called on the remote server. This can be useful for reducing long file names or simply labeling something so that you can find it more easily yourself. The general syntax would be:
For example, if you want to save an iOS IPSW file that you found on Apple servers without the long full name, you can use:
curl -o iPhone5C-704.ipsw http://appldnld.apple.com/iOS7/031-1828.20131114.P3wE4/iPhone5,3_7.0.4_11B554a_Restore.ipsw
This will download the file “iPhone5,3_7.0.4_11B554a_Restore.ipsw”, but called shorter as the more meaningful “iPhone5C-704.ipsw”.
If you prefer not to save the file in the current working directory, specify a path as part of the file name, such as:
curl -o ~ / Desktop / localexample.dmg http: //url-to-file/example.dmg
Download multiple files at once with curl
cURL can easily download multiple files at the same time, all you need to do is specify more than one URL, such as:
For files with different names, or hosted on different servers, or within different folder paths, use the full URL, for example:
curl -O http://ftp.gnu.org/gnu/Licenses/fdl-1.1.txt http://ftp.gnu.org/gnu/Licenses/lgpl-2.1.txt http://ftp.gnu.org /gnu/GNUinfo/Audio/index.txt
On the other hand, if the file names to be downloaded use incremental naming, you can use parentheses to specify a download range, such as:
curl -O http://ftp.gnu.org/gnu/Licenses/fd1-1.text
This would grab the files fdl-1.1.txt, fd1-1.2.txt and fd1-1.3.txt all at the same time without having to specify each unique URL. This of course only works if the files are together in the same directory and on the same domain.
Authentication with curl
You can also pass authentication with cURL by using the -u flag:
curl -u user: pass -O ftp: //remote_url/file-to-download.zip
Note that bash history will store the password in plain text when you use -u with a specified username and password, so this is not recommended in most situations. You can get around that by putting a space before ‘curl’. If you don’t use the spacebar to prefix the command, you probably want to clear the command history afterwards, just in case.
Supported curl protocols and uses outside of HTTP and FTP
As mentioned earlier, using cURL goes well beyond HTTP and FTP as curl’s manual page entry lists additional protocols in the description:
curl is a tool to transfer data to or from a server using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP , RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP).
In addition, you will find that curl can also be used for PUT and POST requests, cookies, proxies, tunnels, resume downloads, and even query HTTP header information or change a user agent (basically spoofing) without requiring a special web. browser.
Like most command line utilities, you can learn a lot more about curl by calling up the appropriate man page with the ‘man curl’ command.
Using cURL to Download Remote Files from the Command Line Guide is free?
This guide is a free model
Free Trial: May be included, please check on the official site, we mentioned above.
The Using cURL to Download Remote Files from the Command Line tutorial price is Free or Freemium. This means you can truly enjoy the Using cURL to Download Remote Files from the Command Line guide.
The Using cURL to Download Remote Files from the Command Line guide gives you an easy-to-use and efficient management and Using cURL to Download Remote Files from the Command Line allows you to focus on the most important things. It’s friendly guide to use maybe you will love it and Using cURL to Download Remote Files from the Command Line tutorial can be used on Linux, Windows or android devices.
Using cURL to Download Remote Files from the Command Line: benefits
- The Using cURL to Download Remote Files from the Command Line tutorial is free .
- Helps many users follow up with interest in a timely manner.
- The price of the Using cURL to Download Remote Files from the Command Line guide is free.
Using cURL to Download Remote Files from the Command Line: FAQ
Tutorial Summary: Using cURL to Download Remote Files from the Command Line
How this tutorial helping you?
What is actual time in which this method complete?
What are the supported Device?
What are the supported Operating system?
Using cURL to Download Remote Files from the Command Line Tutorial: final note
For our visitors: If you have any queries regards the Using cURL to Download Remote Files from the Command Line, then please ask us through the comment section below or directly contact us.
Education: This guide or tutorial is just for educational purposes.
Misinformation: If you want to correct any misinformation about the guide “Using cURL to Download Remote Files from the Command Line”, then kindly contact us.
Want to add an alternate method: If anyone wants to add the more methods to the guide Using cURL to Download Remote Files from the Command Line, then kindly contact us.
Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following the Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off).
Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.