Home > Network Management > curl

The Complete Guide to the Curl Command

`curl` is a powerful command-line tool used to transfer data using URL syntax. It can perform various network tasks such as communicating with web servers or downloading files. It supports various protocols including HTTP, HTTPS, FTP, FTPS, SCP, and SFTP.

Main Options

Learn various ways to send web requests using the `curl` command. You can combine the options below to create requests in your desired format.

1. Basic Requests

2. HTTP Request Methods

3. Advanced Usage

Generated command:

Try combining the commands.

Description:

`curl` Executes the command.

Combine the above options to virtually execute commands with AI.

Installing Curl

`curl` is typically pre-installed on most Linux systems, but if it's not, you can easily install it using the command below.

Debian/Ubuntu

sudo apt update
sudo apt install curl

How to install curl on Debian or Ubuntu-based systems.

CentOS/RHEL/Fedora

sudo yum install curl

How to install curl on CentOS, RHEL, or Fedora-based systems.

Arch Linux

sudo pacman -S curl

How to install curl on Arch Linux.

Commonly Used Examples

Learn how to use the command through real scenarios utilizing `curl`.

Check Web Page Content

curl https://www.google.com

Outputs the HTML content of the Google homepage to the terminal.

Download File

curl -O https://example.com/data.zip

Downloads a file from a remote server to the current directory.

Send POST Request to API (JSON Data)

curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "age":30}' https://api.example.com/users

Sends a POST request to the API endpoint including JSON data.

Check Response Headers

curl -I https://www.google.com

Checks only the response headers from a web request.

Check HTTP Status Code Only

curl -s -o /dev/null -w "%{http_code}" https://www.google.com

Outputs only the HTTP status code of the web request and hides all other outputs.


Same category commands