curl is a command-line tool for transferring data using various network protocols. Supporting HTTP, HTTPS, FTP, and many more, curl is essential for testing APIs, downloading files, and automating web requests.
📑 Table of Contents
Key Features
- Protocol Support: HTTP, HTTPS, FTP, SFTP, and more
- Authentication: Basic, digest, OAuth support
- SSL/TLS: Secure connections
- Proxy Support: HTTP and SOCKS proxies
- Resume Downloads: Continue interrupted transfers
Installation
curl is typically pre-installed:
sudo apt install curl
Usage Examples
Common curl commands:
# Simple GET request
curl https://api.example.com/users
# POST JSON data
curl -X POST -H "Content-Type: application/json" \
-d '{"name":"John"}' https://api.example.com/users
# Download file
curl -O https://example.com/file.zip
# Follow redirects
curl -L https://example.com
# With headers
curl -H "Authorization: Bearer token" https://api.example.com
# Silent with output
curl -s https://api.example.com | jq
Benefits
curl is indispensable for API testing and automation. Its extensive protocol support and scripting capabilities make it a universal network tool.
Was this article helpful?