Online Linux Terminal Logo
OnlineLinuxTerminal
Networking & TransferCLI Reference

$curl

Transfer data from or to a server using HTTP, HTTPS, FTP, and more.

Syntax DefinitionPOSIX standard
curl [OPTIONS] [URL...]
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `curl` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

Overview & How curl Works

`curl` (Client URL) is a universal command-line utility for transferring data across networks. It supports HTTP, HTTPS, FTP, SFTP, and REST API testing with custom headers, authentication, cookies, and proxy routing.

Common Flags & Command Options

Flag / OptionDescription
-I, --headFetch HTTP response headers only without downloading body.
-L, --locationFollow HTTP 301/302 redirects automatically.
-X, --request [METHOD]Specify custom HTTP request method (GET, POST, PUT, DELETE).
-d, --data [data]Send POST data payload in request body.
-H, --header [header]Pass custom HTTP request header (e.g., "Authorization: Bearer token").
-o [file]Write output to file instead of stdout.

Practical Real-World Examples

Example #1Inspect HTTP response headers of a website
curl -I https://onlinelinuxterminal.com

Fetches HTTP status code, content-type, cache-control, and server headers.

Sample Output:
HTTP/2 200 content-type: text/html; charset=utf-8 server: cloudflare
Example #2Download a remote file
curl -O https://example.com/archive.zip

Downloads archive.zip preserving remote file name.

Frequently Asked Questions

How do you send a JSON POST request with curl?

Use `curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com`.