GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
* Sign Up! *

Support
Customer Portal
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

cURL: Command-Line URL Transfers

bullet Introduction

cURL is a command-line tool for transferring data to and from a server. It speaks a long list of protocols — HTTP, HTTPS, FTP, SFTP, and more — which makes it the standard way to fetch a URL, test an API, download a file, or check that your own web site is responding correctly, all without leaving the shell.

cURL is closely related to Wget. The rule of thumb: reach for Wget when you want to download files (especially whole directories or recursive mirrors), and reach for cURL when you want to interact with a service — send data, set headers, follow an API conversation, or script a request and read the response.

 

bullet Installation

cURL is so commonly used that it is often already present. Check with curl --version; if it is missing, connect to your VPS, become root, and install it:

On FreeBSD 15:

# pkg install curl

On Rocky Linux 10:

# dnf install curl

 

bullet Everyday Usage

By default, cURL prints what it fetches to your terminal. The options you will use most often save it to a file, follow redirects, and show what is happening:

$ curl https://example.com/                 # print the page to the screen
$ curl -O https://example.com/file.tar.gz   # save as the remote file name
$ curl -o site.html https://example.com/    # save under a name you choose
$ curl -L https://example.com/              # -L follows redirects (http -> https, etc.)
$ curl -I https://example.com/              # -I shows only the response headers

To confirm your own site is up and serving the right thing — useful in a cron health check — combine -I (headers only) with -s (quiet) and -S (still show errors):

$ curl -sS -I https://your-domain.example/

 

bullet Working with APIs

Where cURL really earns its place is talking to web services. You can choose the request method, add headers, and send a body — everything a REST API needs:

# A POST request with a JSON body and an auth header
$ curl -X POST https://api.example.com/v1/items \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer YOUR_TOKEN" \
       -d '{"name":"widget","qty":12}'

Add -i to include the response headers in the output, or -v (verbose) to watch the whole exchange — the TLS handshake, the request headers cURL sent, and the response — which is the single most useful way to debug why a request is not behaving as expected.

TIP: Avoid putting secrets such as API tokens directly on the command line — they are visible in your shell history and to anyone running ps. Read them from a file or an environment variable instead, for example -H "Authorization: Bearer $API_TOKEN" with the token exported in your shell.

 

bullet Documentation

The curl(1) manual page lists every one of its many options. The project site has tutorials, a protocol-by-protocol guide, and a free book:


Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2026 GSP Services, Inc.