Skip to main content

2. Command line options

About 2 minCLILinuxcrashcourseclishshellgnulinuxawk

2. Command line options ๊ด€๋ จ


2. Command line options

Mastering curl - interactive text guide

Curl performs internet transfers, where it acts as a client, uploading or downloading data from a remote server. The data can be anything: text, images, audio, video, and so on.

Curl supports both unauthenticated protocols (such as HTTP or FTP) and their authenticated counterparts (such as HTTPS or FTPS). Data transferred over an unauthenticated protocol can be intercepted and tampered with, so it's better to always use authenticated ones. Curl can disable server verification with an --insecure flag, but you better not do this in production.

Curl currently has about 250 options, and the number is growing at a rate of โ‰ˆ10/year.

There are short command line options :

single dash
curl -V
#
# curl 8.2.1 (x86_64-alpine-linux-musl) libcurl/8.2.1 OpenSSL/3.1.2 zlib/1.2.13 brotli/1.0.9 libidn2/2.3.4 nghttp2/1.55.1
# Release-Date: 2023-07-26
# Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
# Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets

All options are available in "long" format, but only some of them have "short" counterparts.

The number of options keeps growing.
The number of options keeps growing.

Some options are of boolean type.

on
curl --silent http://httpbin/uuid
# {
#   "uuid": "8cf5314e-2c21-42ae-a417-f78f85469f74"
# }

Some options accept arguments:

curl --output /tmp/uuid.json http://httpbin/uuid
#

Arguments that contain spaces should be enclosed in quotes:

curl -o /dev/null --write-out "type: %{content_type}" http://httpbin/uuid
# type: application/json; charset=utf-8

์ด์ฐฌํฌ (MarkiiimarK)
Never Stop Learning.