Wiki guide Linux CURL Command examples

CURL Useful Commands in Linux

Topic: Wiki guide Linux CURL Command examples
linux curl

cURL is very useful command line tool to transfer data from or to a server. cURL supports various protocols like FILE, HTTP, HTTPS, IMAP, IMAPS, LDAP, DICT, LDAPS, TELNET, FTP, FTPS, GOPHER, RTMP, RTSP, SCP, SFTP, POP3, POP3S, SMB, SMBS, SMTP, SMTPS, and TFTP.
cURL can be used in many different and interesting ways. With this tool you can download, upload and manage files, check your email address, or even update your status on some of the social media websites or check the weather outside. In this article will cover five of the most useful and basic uses of the cURL tool on any Linux 

1. Check URL

One of the most common and simplest uses of cURL is typing the command itself, followed by the URL you want to check
This command will display the content of the URL on your terminal

2. Save the output of the URL to a file

The output of the cURL command can be easily saved to a file by adding the -o option to the command, as shown below
curl -o website

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 41793    0 41793    0     0   275k      0 --:--:-- --:--:-- --:--:--  2.9M
In this example, output will be save to a file named ‘website’ in the current working directory.

3. Download files with cURL

You can downlaod files with cURL by adding the -O option to the command. It is used for saving files on the local server with the same names as on the remote server
curl -O
In this example, the ‘’ zip archive will be downloaded to the current working directory.
You can also download the file with a different name by adding the -o option to cURL.
curl -o
This way the ‘’ archive will be downloaded and saved as ‘’.
cURL can be also used to download multiple files simultaneously, as shown in the example below
curl -O -O
cURL can be also used to download files securely via SSH using the following command
curl -u user s
Note that you have to use the full path of the file you want to download

4. Get HTTP header information from a website

You can easily get HTTP header information from any website you want by adding the -I option (capital ‘i’) to cURL.
curl -I

HTTP/1.1 200 OK
Date: Sun, 16 Oct 2016 23:37:15 GMT
Server: Apache/2.4.23 (Unix)
X-Powered-By: PHP/5.6.24
Connection: close
Content-Type: text/html; charset=UTF-8

5. Access an FTP server

To access your FTP server with cURL use the following command
curl --user username:password
cURL will connect to the FTP server and list all files and directories in user’s home directory
You can download a file via FTP
curl --user username:password
and upload a file ot the FTP server
curl -T --user username:password
You can check cURL manual page to see all available cURL options and functionalities
man curl
  • Ajit Kumar
    Ajit Kumar April 4, 2022 at 11:09 AM

    curl tutorial for self study

Add Comment
comment url