Using Curl Command On Linux With Examples
What is the Curl?
Curl is a command-line utility for transferring data from or to a server designed to work without user interaction. With curl, you can download or upload data using one of the supported protocols including HTTP, HTTPS, SCP , SFTP , and FTP . curl provides a number of options allowing you to resume transfers, limit the bandwidth, proxy support, user authentication, and much more.
Install Curl
apt update
apt install curl
Who to use Curl?
curl [OPTIONS] [URL]
- curl -h or curl — help
This command opens help menu.
2. curl — version or curl -V
This command shows Curl version information
3. curl https://google.com
This command shows the source code of the site
4. curl -O https://www.aa.com/fingerprint/assets/css/v3/home-page-8b3e101794c558b07adce7ad5a8755812.css
This command will download any file
5. curl-o miri.css https://www.aa.com/fingerprint/assets/css/v3/home-page-8b3e101794c558b07adce7ad5a8755812.css
This command will download the file with the name we have written.
6. curl -C — -O https://www.aa.com/fingerprint/assets/css/v3/home-page-8b3e101794c558b07adce7ad5a8755812.css
This command is for downloading the file whose download is interrupted
7. curl -O https://www.aa.com/fingerprint/assets/css/v3/home-page-8b3e101794c558b07adce7ad5a8755812.css -O https://tags.tiqcdn.com/utag/aa/main/prod/utag.sync.js
This command is also used to download two or more files.
8. curl -I big.az
This command is used to get only the HTTP headers of the specified resource.
9. curl -u username:password -T file.tar.gz ftp://testftpserver
This command will upload the file to ftp server
10.curl -u username:password -O ftp://testftpserver/testdosyasi.tar.gz
This command will download file from ftp server
11. curl — limit-rate 100K http://test.com/file.tar.gz -O
This command limits file download speed to 100 KB/s