GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Spiegazione del comando Linux curl con esempi

Introduzione

Il trasferimento di dati da e verso un server richiede strumenti che supportino i protocolli di rete necessari. Linux ha diversi strumenti creati per questo scopo, i più popolari sono curl e wget.

Questo tutorial ti mostrerà come usare il curl comando e fornirti un elenco completo delle opzioni disponibili.

Prerequisiti

  • Accesso al terminale
  • Accesso a Internet
  • ricciolo installato

Cos'è il comando curl?

curl (abbreviazione di "URL client") è uno strumento a riga di comando che consente il trasferimento di dati su vari protocolli di rete. Comunica con un server Web o applicativo specificando un URL pertinente e i dati che devono essere inviati o ricevuti.

curl è alimentato da libcurl, una libreria di trasferimento URL lato client portatile. Puoi usarlo direttamente sulla riga di comando o includerlo in uno script. I casi d'uso più comuni per curl sono:

  • Download di file da Internet
  • Test degli endpoint
  • Debug
  • Registrazione errori

Sintassi curl

Il curl di base la sintassi è la seguente:

curl [options/URLs]

Ad esempio:

curl https://www.gnu.org/gnu/gnu.html

Il sistema restituisce i contenuti HTML trovati sull'URL fornito dopo il curl comando.

Se specifichi un URL che rimanda a un file, puoi utilizzare curl per scaricare il file sul tuo sistema locale:

curl [url] > [local-file]

La barra di avanzamento mostra quanto del file è stato scaricato finora.

La sintassi degli URL che fanno parte del comando dipende dal protocollo. Più URL che differiscono in una parte vengono scritti insieme usando le parentesi graffe:

http://example.{first,second,third}.com

Le serie alfanumeriche si scrivono tra parentesi:

ftp://ftp.url.com/file[1-100].txt

Sebbene le sequenze nidificate non siano supportate, sono consentite più sequenze:

http://url.com/archive[2010-2020]/vol[1-4]/part{a,b,c}.html

Protocolli curl

curl supporta numerosi protocolli per il trasferimento dei dati. Trova l'elenco completo di seguito.

Protocollo Descrizione
DICT Un protocollo di rete del dizionario per interrogare i server del dizionario sul significato delle parole.
FILE Uno schema URL per ottenere un file dal file system locale utilizzando curl.
FTP, FTPS File Transfer Protocol, utilizzato per i trasferimenti di file tra client e server. FTPS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
GOPHER, GOPHER Un vecchio protocollo per la ricerca, il recupero e la distribuzione di documenti Internet, precursore dell'HTTP. GOPHERS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
HTTP, HTTPS Hypertext Transfer Protocol, utilizzato per il trasferimento di dati Web e Internet. HTTPS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
IMAP, IMAPS Internet Message Access Protocol, utilizzato per l'accesso e la gestione della posta elettronica. IMAPS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
LDAP, LDAPS Lightweight Directory Access Protocol, utilizzato per l'accesso e la gestione delle informazioni di directory distribuite. LDAPS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
MQTT Message Queuing Telemetry Transport:un protocollo per lo scambio di dati tra piccoli dispositivi, solitamente sistemi IoT.
POP3, POP3S Post Office Protocol versione 3:un protocollo per il recupero delle e-mail da un server. POP3S è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
RTMP Protocollo di messaggistica in tempo reale:un protocollo di streaming per audio, video e altri dati.
RTSP Protocollo di streaming in tempo reale, utilizzato per la gestione dei server multimediali in streaming.
SCP Copia protetta:un protocollo per la copia di file da e verso un server SSH.
SFTP SSH File Transfer Protocol:una versione del File Transfer Protocol che utilizza la connessione SSH.
PMI, SMBS Server Message Block - un protocollo per la gestione dell'accesso condiviso a file e periferiche del computer. SMBS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
SMTP, SMPTS Simple Mail Transfer Protocol:un protocollo e-mail per una facile trasmissione di e-mail. SMTPS è la versione dello stesso protocollo con un livello di sicurezza SSL/TLS aggiunto.
TELNET Un protocollo a livello di applicazione per la comunicazione interattiva bidirezionale orientata al testo.
TFTP Trivial File Transfer Protocol, utilizzato per caricare o scaricare file su o da un host remoto.

Opzioni comando curl

curl accetta una vasta gamma di opzioni, il che lo rende un comando estremamente versatile. Le opzioni iniziano con uno o due trattini. Se non richiedono valori aggiuntivi, le opzioni a trattino singolo possono essere scritte insieme. Ad esempio, il comando che utilizza il -O , -L e -v le opzioni possono essere scritte come:

curl -OLv [url]

Di seguito è riportato l'elenco di tutte le opzioni disponibili.

Opzione Descrizione
--abstract-unix-socket <path> Connetti tramite socket Unix astratto invece tramite una rete.

Esempio:
curl --abstract-unix-socket socketpath https://example.com
--alt-svc <file name> Abilita il parser alt-svc.

Esempio:
curl --alt-svc svc.txt https://example.com
--anyauth Curl trova e utilizza il metodo di autenticazione più sicuro per l'URL HTTP specificato.

Esempio:
curl --anyauth --user me:pass https://example.com
-a, --append Aggiungi al file di destinazione.

Esempio:
curl --upload-file local --append ftp://example.com/
--aws-sigv4 <provider1[:provider2[:region[:service]]]> Utilizza l'autenticazione della firma AWS V4.

Esempio:
curl --aws-sigv4 "aws:amz:east-2:es" --user "key:secret" https://example.com
--basic Utilizza l'autenticazione di base HTTP.

Esempio:
curl -u name:password --basic https://example.com
--cacert <file> Utilizzare il file specificato per la verifica del certificato.

Esempio:
curl --cacert CA-file.txt https://example.com
--capath <dir> Usa la directory specificata per cercare i certificati.

Esempio:
curl --capath /local/directory https://example.com
--cert-status Verifica lo stato del certificato del server.

Esempio:
curl --cert-status https://example.com
--cert-type <type> Specificare il tipo di certificato fornito. I tipi riconosciuti sono PEM (predefinito), DER , ENG e P12 .

Esempio:
curl --cert-type ENG --cert file https://example.com
-E, --cert <certificate[:password]> Utilizzare il file del certificato fornito quando si lavora con un protocollo basato su SSL.

Esempio:
curl --cert certfile --key keyfile https://example.com
--ciphers <list of ciphers> Fornire i codici da utilizzare nella connessione.

Esempio:
curl --ciphers ECDHE-ECDSA-AES256-CCM8 https://example.com
--compressed-ssh Abilita la compressione SSH incorporata.

Esempio:
curl --compressed-ssh sftp://example.com/
--compressed Richiesta di ricevere una risposta compressa.

Esempio:
curl --compressed https://example.com
-K, --config <file> Fornire un file di testo con argomenti curl, invece di scriverli sulla riga di comando.

Esempio:
curl --config file.txt https://example.com
--connect-timeout <fractional seconds> Specifica il tempo massimo che può durare una connessione curl.

Esempio:
curl --connect-timeout 30 https://example.com
--connect-to <HOST1:PORT1:HOST2:PORT2> Fornire una regola di connessione per indirizzare le richieste a un nodo del cluster di server specifico.

Esempio:
curl --connect-to example.com:443:example.net:8443 https://example.com
-C, --continue-at <offset> Riprendi il trasferimento del file all'offset specificato.

curl -C 400 https://example.com
-c, --cookie-jar <filename> Specificare un file per la memorizzazione dei cookie.

curl -c store.txt https://example.com
-b, --cookie <data|filename> Legge i cookie da un file.

Esempio:
curl -b cookiefile https://example.com
--create-dirs Crea le directory locali per il --output opzione.

Esempio:
curl --create-dirs --output local/dir/file https://example.com
--create-file-mode <mode> Specificare quale modalità impostare al momento della creazione del file.

Esempio:
curl --create-file-mode 0777 -T localfile sftp://example.com/new
--crlf Converti LF in CRLF.

curl --crlf -T file ftp://example.com/
--crlfile <file> Fornire un elenco di revoche di certificati per i certificati peer.

curl --crlfile revoke.txt https://example.com
--curves <algorithm list> Fornire curve per stabilire una sessione SSL.

Esempio:
curl --curves X25519 https://example.com
--data-ascii <data> Vedi -d , --data .

Esempio:
curl --data-ascii @file https://example.com
--data-binary <data> Pubblica i dati come specificato, senza ulteriori elaborazioni.

curl --data-binary @filename https://example.com
--data-raw <data> Come -d , --data , ma il carattere @ non viene trattato in modo diverso dal resto.

curl --data-raw "@[email protected]@" https://example.com
--data-urlencode <data> Come -d , --data , ma esegui la codifica URL.

Esempio:
curl --data-urlencode name=val https://example.com
-d, --data <data> Invia dati a un server HTTP in una richiesta POST.

Esempio:
curl -d "name=curl" https://example.com
--delegation <LEVEL> Specificare quando il server può delegare le credenziali.

Esempio:
curl --delegation "always" https://example.com
--digest Abilita l'autenticazione HTTP Digest.

Esempio:
curl -u name:password --digest https://example.com
--disable-eprt Disabilita i comandi EPRT e LPRT per i trasferimenti FTP attivi.

Esempio:
curl --disable-eprt ftp://example.com/
--disable-epsv Disabilita EPSV per trasferimenti FTP passivi.

Esempio:
curl --disable-epsv ftp://example.com/
-q, --disable Disabilita la lettura del file di configurazione curlrc.

curl -q https://example.com 
--disallow-username-in-url Esci se fornito con un URL che contiene un nome utente.

Esempio:
curl --disallow-username-in-url https://example.com
--dns-interface <interface> Specificare un'interfaccia per le richieste DNS in uscita.

Esempio:
curl --dns-interface eth0 https://example.com
--dns-ipv4-addr <address> Specificare un indirizzo IPv4 da cui proverranno le richieste DNS.

Esempio:
curl --dns-ipv4-addr 10.1.2.3 https://example.com
--dns-ipv6-addr <address> Specificare un indirizzo IPv6 da cui provengono le richieste DNS.

Esempio:
curl --dns-ipv6-addr 2a04:4e42::561 https://example.com
--dns-servers <addresses> Specifica il tuo elenco di server DNS.

Esempio:
curl --dns-servers 192.168.0.1,192.168.0.2 https://example.com
--doh-cert-status --cert-status per DNS su HTTPS.

Esempio:
curl --doh-cert-status --doh-url https://doh.server https://example.com 
--doh-insecure -k , --insecure per DoH.

Esempio:
curl --doh-insecure --doh-url https://doh.server https://example.com
--doh-url <URL> Specificare un server DoH per la risoluzione del nome host.

Esempio:
curl --doh-url https://doh.server https://example.com 
-D, --dump-header <filename> Specificare un file per la scrittura delle intestazioni del protocollo.

Esempio:
curl --dump-header store.txt https://example.com 
--egd-file <file> Fornire un percorso per il socket EGD.

Esempio:
curl --egd-file /path/here https://example.com 
--engine <name> Specifica un motore crittografico OpenSSL.

Esempio:
curl --engine flavor https://example.com 
--etag-compare <file> Richiedi una lettura ETag da un file.

Esempio:
curl --etag-compare etag.txt https://example.com 
--etag-save <file> Salva un ETag HTTP in un file.

Esempio:
curl --etag-save etag.txt https://example.com 
--expect100-timeout <seconds> Tempo di attesa massimo per una risposta di 100 continue.

Esempio:
curl --expect100-timeout 2.5 -T file https://example.com 
--fail-early Di' a curl di fallire ed esci quando rileva il primo errore nel trasferimento.

Esempio:
curl --fail-early https://example.com https://two.example 
--fail-with-body Se il server restituisce un errore con codice 400 o superiore, curl salva il contenuto e restituisce l'errore 22.

Esempio:
curl --fail-with-body https://example.com 
-f, --fail Se il server restituisce un errore, curl non riesce silenziosamente e restituisce l'errore 22.

Esempio:
curl --fail https://example.com 
--false-start Usa falsa partenza sull'handshake TLS.

Esempio:
curl --false-start https://example.com 
--form-string <name=string> Simile a -F , --form , ma le stringhe di valori vengono elaborate letteralmente.

Esempio:
curl --form-string "data" https://example.com 
-F, --form <name=content> Emula un modulo con un Invia pulsante che è stato premuto. Il @ sign forza il contenuto a essere un file. Il < sign estrae solo la parte del contenuto del file.

Esempio:
curl --form "name=curl" --form "[email protected]" https://example.com
--ftp-account <data> Specificare i dati dell'account per il server FTP.

Esempio:
curl --ftp-account "account_data" ftp://example.com/
--ftp-alternative-to-user <command> Specificare il comando da inviare se l'autenticazione di nome utente e password non riesce.

Esempio:
curl --ftp-alternative-to-user "U53r" ftp://example.com 
--ftp-create-dirs Se la directory specificata non esiste, curl tenterà di crearla.

Esempio:
curl --ftp-create-dirs -T file ftp://example.com/dirs/one/file 
--ftp-method <method> Specificare un metodo da utilizzare per ottenere file tramite FTP. I metodi disponibili sono multicwd , nocwd e singlecwd .

Esempio:
curl --ftp-method multicwd ftp://example.com/dir1/dir2/file 
--ftp-pasv Utilizza la modalità di connessione dati passiva.

Esempio:
curl --ftp-pasv ftp://example.com/ 
-P, --ftp-port <address> Invertire i ruoli predefiniti per la connessione FTP.

Esempio:
curl -P eth0 ftp:/example.com 
--ftp-pret Invia il comando PRET prima di PASV/EPSV.

Esempio:
curl --ftp-pret ftp://example.com/ 
--ftp-skip-pasv-ip Non utilizzare l'indirizzo IP suggerito dal server. curl utilizzerà l'IP della connessione di controllo.

Esempio:
curl --ftp-skip-pasv-ip ftp://example.com/ 
--ftp-ssl-ccc-mode <active/passive> Imposta la modalità Cancella canale di comando (CCC).

Esempio:
curl --ftp-ssl-ccc-mode active --ftp-ssl-ccc ftps://example.com/ 
--ftp-ssl-ccc Una volta completata l'autenticazione, il livello SSL/TLS viene eliminato, consentendo comunicazioni non crittografate.

Esempio:
curl --ftp-ssl-ccc ftps://example.com/ 
--ftp-ssl-control Utilizzare SSL/TLS per l'accesso, interrompere la crittografia all'avvio del trasferimento dei dati.

Esempio:
curl --ftp-ssl-control ftp://example.com 
-G, --get Utilizza la richiesta HTTP GET invece di POST.

Esempio:
curl --get -d "tool=curl" -d "age=old" https://example.com
-g, --globoff Disabilita il parser di globbing URL.

Esempio:
curl -g "https://example.com/{[]}}}}" 
--happy-eyeballs-timeout-ms <milliseconds> Utilizza l'algoritmo Happy Eyeballs per la connessione a host dual-stack.

Esempio:
curl --happy-eyeballs-timeout-ms 500 https://example.com 
--haproxy-protocol Utilizzare l'intestazione del protocollo HAProxy PROXY v1.

Esempio:
curl --haproxy-protocol https://example.com 
-I, --head Ottieni solo intestazioni.

Esempio:
curl -I https://example.com 
-H, --header <header/@file> Specificare un'intestazione aggiuntiva da inviare nella richiesta HTTP.

Esempio:
curl -H "X-First-Name: Joe" https://example.com 
-h, --help <category> Vedi la guida per una categoria specifica. all elenca tutte le opzioni disponibili.

Esempio:
curl --help all 
--hostpubmd5 <md5> Passa una stringa esadecimale di 32 cifre.

Esempio:
curl --hostpubmd5 e5c1c49020640a5ab0f2034854c321a8 sftp://example.com/ 
--hsts <file name> Abilita HSTS.

Esempio:
curl --hsts cache.txt https://example.com 
--http0.9 Accetta una risposta HTTP versione 0.9.

Esempio:
curl --http0.9 https://example.com
-0, --http1.0 Usa HTTP versione 1.0.

Esempio:
curl --http1.0 https://example.com
--http1.1 Usa HTTP versione 1.1.

Esempio:
curl --http1.1 https://example.com 
--http2-prior-knowledge Usa HTTP versione 2.0. Utilizzare questa opzione se si sa che il server supporta questa versione HTTP.

Esempio:
curl --http2-prior-knowledge https://example.com
--http2 Tentativo di utilizzare HTTP versione 2.0.

Esempio:
curl --http2 https://example.com
--http3 Usa HTTP versione 3.0. Questa è un'opzione sperimentale.

Esempio:
curl --http3 https://example.com
--ignore-content-length Ignora l'intestazione Content-Length.

Esempio:
curl --ignore-content-length https://example.com
-i, --include Specificare che l'output deve includere le intestazioni della risposta HTTP.

Esempio:
curl -i https://example.com
-k, --insecure Consenti a curl di funzionare con connessioni non sicure.

Esempio:
curl --insecure https://example.com 
--interface <name> Specifica l'interfaccia per eseguire un'azione.

Esempio:
curl --interface eth0 https://example.com 
-4, --ipv4 Risolvi solo i nomi in indirizzi IPv4.

Esempio:
curl --ipv4 https://example.com 
-6, --ipv6 Risolvi solo i nomi in indirizzi IPv6.

Esempio:
curl --ipv6 https://example.com
-j, --junk-session-cookies Elimina i cookie di sessione.

Esempio:
curl --junk-session-cookies -b cookies.txt https://example.com 
--keepalive-time <seconds> Specifica il tempo di inattività per la connessione prima che invii i probe keepalive.

Esempio:
curl --keepalive-time 30 https://example.com 
--key-type <type> Specificare il tipo di chiave privata. I tipi disponibili sono PEM (predefinito), DER e ENG .

Esempio:
curl --key-type ENG --key here https://example.com 
--key <key> Specificare il file contenente la chiave privata.

Esempio:
curl --cert certificate --key here https://example.com 
--krb <level> Abilita e usa l'autenticazione Kerberos. I livelli disponibili sono clear , safe , confidential e private (predefinito).

Esempio:
curl --krb clear ftp://example.com/ 
--libcurl <file> Ottieni il codice sorgente C per l'operazione della riga di comando specificata.

Esempio:
curl --libcurl client.c https://example.com 
--limit-rate <speed> Specifica la velocità massima di trasferimento in upload e download.

Esempio:
curl --limit-rate 100K https://example.com 
-l, --list-only Forza una visualizzazione solo nome.

Esempio:
curl --list-only ftp://example.com/dir/ 
--local-port <num/range> Specificare i numeri di porta da utilizzare per la connessione.

Esempio:
curl --local-port 1000-3000 https://example.com 
--location-trusted Simile a -L , --location , ma consente di inviare nome e password a tutti i reindirizzamenti.

Esempio:
curl --location-trusted -u user:pass https://example.com
-L, --location Consenti a curl di seguire qualsiasi reindirizzamento.

Esempio:
curl -L https://example.com 
--login-options <options> Specificare le opzioni di accesso per l'autenticazione del server di posta elettronica.

Esempio:
curl --login-options 'AUTH=*' imap://example.com 
--mail-auth <address> Fornire un unico indirizzo come identità.

Esempio:
curl --mail-auth [email protected] -T mail smtp://example.com/ 
--mail-from <address> Fornire un unico indirizzo "da".

Esempio:
curl --mail-from [email protected] -T mail smtp://example.com/ 
--mail-rcpt-allowfails Consente a curl di continuare con la conversazione SMTP se uno dei destinatari non riesce.

Esempio:
curl --mail-rcpt-allowfails --mail-rcpt [email protected] smtp://example.com 
--mail-rcpt <address> Fornire un unico indirizzo "a".

Esempio:
curl --mail-rcpt [email protected] smtp://example.com 
-M, --manual Leggi il manuale dell'arricciatura.

Esempio:
curl --manual 
--max-filesize <bytes> Fornire la dimensione massima del file da scaricare.
Esempio:
curl --max-filesize 500K https://example.com 
--max-redirs <num> Specifica il numero massimo di reindirizzamenti quando --location è attivo.

Esempio:
curl --max-redirs 3 --location https://example.com 
-m, --max-time <fractional seconds> Specifica il tempo massimo per un'operazione.

Esempio:
curl --max-time 5.52 https://example.com 
--metalink Specifica una risorsa di collegamento meta. Questa opzione è disabilitata nelle versioni più recenti di curl.

Esempio:
curl --metalink file https://example.com 
--negotiate Abilita l'autenticazione SPNEGO.

Esempio:
curl --negotiate -u : https://example.com
--netrc-file <filename> Come --n , --netrc , ma consente di specificare il file da utilizzare.

Esempio:
curl --netrc-file netrc https://example.com 
--netrc-optional Come --n , --netrc , ma l'utilizzo di netrc è facoltativo.

Esempio:
curl --netrc-optional https://example.com 
-n, --netrc Cerca le informazioni di accesso nel file netrc.

Esempio:
curl --netrc https://example.com 
-:, --next Utilizza l'opzione per separare le richieste URL.

Esempio:
curl -I https://example.com --next https://example.net/ 
--no-alpn Disabilita l'estensione TLS ALPN.

Esempio:
curl --no-alpn https://example.com 
-N, --no-buffer Disabilita il buffer del flusso di output.

Esempio:
curl --no-buffer https://example.com 
--no-keepalive Disabilita i messaggi keep-alive.

Esempio:
curl --no-keepalive https://example.com 
--no-npn Disabilita l'estensione TLS NPN.

Esempio:
curl --no-npn https://example.com 
--no-progress-meter Disabilita la barra di avanzamento ma visualizza qualsiasi altro messaggio.

Esempio:
curl --no-progress-meter -o store https://example.com 
--no-sessionid Disabilita la memorizzazione nella cache dell'ID sessione SSL.

Esempio:
curl --no-sessionid https://example.com 
--noproxy <no-proxy-list> Elenca gli host che non dovrebbero usare un proxy.

Esempio:
curl --noproxy "www.example" https://example.com 
--ntlm-wb Come --ntlm , ma consegna anche l'autenticazione a ntlmauth.

Esempio:
curl --ntlm-wb -u user:password https://example.com 
--ntlm Abilita l'autenticazione NTLM.

Esempio:
curl --ntlm -u user:password https://example.com 
--oauth2-bearer <token> Fornire un token al portatore per OAUTH 2.0.

Esempio:
curl --oauth2-bearer "mF_9.B5f-4.1JqM" https://example.com 
--output-dir <dir> Specifica la directory del file di output.

Esempio:
curl --output-dir "tmp" -O https://example.com 
-o, --output <file> Memorizza l'output in un file. L'output non viene visualizzato in stdout.

Esempio:
curl -o file https://example.com -o file2 https://example.net 
--parallel-immediate Preferisci le connessioni parallele all'attesa di nuove connessioni o flussi multiplexati.

Esempio:
curl --parallel-immediate -Z https://example.com -o file1 https://example.com -o file2
--parallel-max <num> Specificare il numero massimo di connessioni parallele.

Esempio:
curl --parallel-max 100 -Z https://example.com ftp://example.com/ 
-Z, --parallel Esegui trasferimenti in parallelo.

Esempio:
curl --parallel https://example.com -o file1 https://example.com -o file2
--pass <phrase> Specificare una passphrase della chiave privata.

Esempio:
curl --pass secret --key file https://example.com 
--path-as-is Impedisci a curl di unire /./ e /../ sequenze.

Esempio:
curl --path-as-is https://example.com/../../etc/passwd
--pinnedpubkey <hashes> Specificare una chiave pubblica da usare per curl.

Esempio:
curl --pinnedpubkey keyfile https://example.com 
--post301 Impedisci a curl di convertire richieste POST in GET dopo un reindirizzamento 301.

Esempio:
curl --post301 --location -d "data" https://example.com 
--post302 Impedisci a curl di convertire richieste POST in GET dopo un reindirizzamento 302.

curl --post302 --location -d "data" https://example.com 
--post303 Impedisci a curl di convertire richieste POST in GET dopo un reindirizzamento 303.

Esempio:
curl --post303 --location -d "data" https://example.com 
--preproxy [protocol://]host[:port] Utilizza il proxy SOCKS come pre-proxy.

Esempio:
curl --preproxy socks5://proxy.example -x http://http.example https://example.com 
-#, --progress-bar Usa la semplice barra di avanzamento.

Esempio:
curl -# -O https://example.com 
--proto-default <protocol> Specifica quale protocollo curl dovrebbe utilizzare per gli URL senza un nome di schema.

Esempio:
curl --proto-default https ftp.example.com 
--proto-redir <protocols> Specificare quali protocolli devono utilizzare curl per il reindirizzamento.

Esempio:
curl --proto-redir =http,https https://example.com 
--proto <protocols> Specifica quali protocolli curl dovrebbe utilizzare per i trasferimenti.

Esempio:
curl --proto =http,https,sftp https://example.com 
--proxy-anyauth Curl dovrebbe scegliere un metodo di autenticazione appropriato.

Esempio:
curl --proxy-anyauth --proxy-user user:passwd -x proxy https://example.com
--proxy-basic Usa HTTP Basic per la comunicazione con un proxy.

Esempio:
curl --proxy-basic --proxy-user user:passwd -x proxy https://example.com 
--proxy-cacert <file> --cacert for HTTPS proxies.

Esempio:
curl --proxy-cacert CA-file.txt -x https://proxy https://example.com 
--proxy-capath <dir> --capath for HTTPS proxies.

Esempio:
curl --proxy-capath /local/directory -x https://proxy https://example.com
--proxy-cert-type <type> --cert-type for HTTPS proxies.

Esempio:
curl --proxy-cert-type PEM --proxy-cert file -x https://proxy https://example.com
--proxy-cert <cert[:passwd]> -E , --cert for HTTPS proxies.

Esempio:
curl --proxy-cert file -x https://proxy https://example.com 
--proxy-ciphers <list> --ciphers for HTTPS proxies.

curl --proxy-ciphers ECDHE-ECDSA-AES256-CCM8 -x https://proxy https://example.com 
--proxy-crlfile <file> --crlfile for HTTPS proxies.

Esempio:
curl --proxy-crlfile rejects.txt -x https://proxy https://example.com
--proxy-digest Use HTTP Digest authentication with a proxy.

Esempio:
curl --proxy-digest --proxy-user user:passwd -x proxy https://example.com 
--proxy-header <header/@file> -H , --header for proxy communication.

Esempio:
curl --proxy-header "Host:" -x http://proxy https://example.com 
--proxy-insecure -k , --insecure for HTTPS proxies.

Esempio:
curl --proxy-insecure -x https://proxy https://example.com 
--proxy-key-type <type> --key-type for HTTPS proxies.

Esempio:
curl --proxy-key-type DER --proxy-key here -x https://proxy https://example.com 
--proxy-key <key> --key for HTTPS proxies.

Esempio:
curl --proxy-key here -x https://proxy https://example.com 
--proxy-negotiate --negotiate for proxy communication.

Esempio:
curl --proxy-negotiate --proxy-user user:passwd -x proxy https://example.com
--proxy-ntlm Use HTTP NTLM authentication with a proxy.

Esempio:
curl --proxy-ntlm --proxy-user user:passwd -x http://proxy https://example.com
--proxy-pass <phrase> --pass for HTTPS proxies.

Esempio:
curl --proxy-pass secret --proxy-key here -x https://proxy https://example.com 
--proxy-pinnedpubkey <hashes> Specify the public key for proxy verification.

Esempio:
curl --proxy-pinnedpubkey keyfile https://example.com 
--proxy-service-name <name> Specify the service name for proxy communciation.

Esempio:
curl --proxy-service-name "shrubbery" -x proxy https://example.com 
--proxy-ssl-allow-beast --ssl-allow-beast for HTTPS proxies.

Esempio:
curl --proxy-ssl-allow-beast -x https://proxy https://example.com 
--proxy-ssl-auto-client-cert --ssl-auto-client-cert for HTTPS proxies.

Esempio:
curl --proxy-ssl-auto-client-cert -x https://proxy https://example.com 
--proxy-tls13-ciphers <ciphersuite list> Specifies the list of cipher suites to use in negotiating TLS 1.3 for proxies.

Esempio:
curl --proxy-tls13-ciphers TLS_AES_128_GCM_SHA256 -x proxy https://example.com
--proxy-tlsauthtype <type> --tlsauthtype for HTTPS proxies.

Esempio:
curl --proxy-tlsauthtype SRP -x https://proxy https://example.com 
--proxy-tlspassword <string> --tlspassword for HTTPS proxies.

Esempio:
curl --proxy-tlspassword passwd -x https://proxy https://example.com 
--proxy-tlsuser <name> --tlsuser for HTTPS proxies.

Esempio:
curl --proxy-tlsuser smith -x https://proxy https://example.com 
--proxy-tlsv1 -1 , --tlsv1 for HTTPS proxies.

Esempio:
curl --proxy-tlsv1 -x https://proxy https://example.com 
-U, --proxy-user <user:password> Specify the username and password for authenticating with a proxy.

Esempio:
curl --proxy-user name:pwd -x proxy https://example.com 
-x, --proxy [protocol://]host[:port] Specify a proxy to use.

Esempio:
curl --proxy http://proxy.example https://example.com 
--proxy1.0 <host[:port]> Specify a HTTP 1.0 proxy to use.

Esempio:
curl --proxy1.0 -x http://proxy https://example.com 
-p, --proxytunnel Create a proxy tunnel.

Esempio:
curl --proxytunnel -x http://proxy https://example.com 
--pubkey <key> Provide a file containing a public key.

Esempio:
curl --pubkey file.pub sftp://example.com/ 
-Q, --quote <command> Send a command to a FTP or SFTP server, to be executed before the transfer.

Esempio:
curl --quote "rm file" ftp://example.com/foo 
--random-file <file> Specify a file containing random data. This file will be used for seeding the random engine.

Esempio:
curl --random-file rubbish https://example.com 
-r, --range <range> Obtain a range of bytes.

Esempio:
curl --range 40-80 https://example.com 
--raw Disable HTTP content decoding and obtain raw data.

Esempio:
curl --raw https://example.com 
-e, --referer <URL> Send Referrer Page information.

Esempio:
curl --referer "https://test.example" https://example.com 
-J, --remote-header-name Use header name specified by the server instead of obtaining it from the URL.

Esempio:
curl -OJ https://example.com/file 
--remote-name-all Apply the -O , --remote-name option to all the URLs.

Esempio:
curl --remote-name-all ftp://example.com/file1 ftp://example.com/file2 
-O, --remote-name Specify that the local file should have the name of the remote file that was downloaded.

Esempio:
curl -O https://example.com/filename 
-R, --remote-time Specify that the local file should have the timestamp of the remote file that was downloaded.

Esempio:
curl --remote-time -o foo https://example.com 
--request-target <path> Specify an alternative target path.

Esempio:
curl --request-target "*" -X OPTIONS https://example.com 
-X, --request <command> Specify a request method for communication with the server.

Esempio:
curl -X "DELETE" https://example.com 
--resolve <[+]host:port:addr[,addr]...> Specify a custom address for a host/port.

Esempio:
curl --resolve example.com:443:127.0.0.1 https://example.com 
--retry-all-errors Force retrying on all errors.

Esempio:
curl --retry-all-errors https://example.com 
--retry-connrefused Add ECONNREFUSED to the list of errors that are eligible for --retry .

Esempio:
curl --retry-connrefused --retry https://example.com 
--retry-delay <seconds> Specify the amount of time between retries.

Esempio:
curl --retry-delay 5 --retry https://example.com 
--retry-max-time <seconds> Specify the maximum amount of time for --retry attempts.

Esempio:
curl --retry-max-time 30 --retry 10 https://example.com 
--retry <num> Specify the number of retries after curl encounters and error.

Esempio:
curl --retry 7 https://example.com
--sasl-authzid <identity> Specify an additional authentication identity for SASL PLAIN authentication.

Esempio:
curl --sasl-authzid zid imap://example.com/ 
--sasl-ir Enable initial response during SASL authentication.

Esempio:
curl --sasl-ir imap://example.com/ 
--service-name <name> Specify the SPNEGO service name.

Esempio:
curl --service-name sockd/server https://example.com 
-S, --show-error Show an error message event with the -s , --silent option enabled.

Esempio:
curl --show-error --silent https://example.com 
-s, --silent Turn on the silent mode. This option mutes curl.

Esempio:
curl -s https://example.com 
--socks4 <host[:port]> Specify a SOCKS4 proxy.

Esempio:
curl --socks4 hostname:4096 https://example.com 
--socks4a <host[:port]> Specify a SOCKS4a proxy.

Esempio:
curl --socks4a hostname:4096 https://example.com 
--socks5-basic Use the basic authentication method (username/password) with a SOCKS5 proxy.

Esempio:
curl --socks5-basic --socks5 hostname:4096 https://example.com 
--socks5-gssapi-nec Allow protection mode negotiation to be unprotected.

Esempio:
curl --socks5-gssapi-nec --socks5 hostname:4096 https://example.com 
--socks5-gssapi-service <name> Change the name of a socks server.

Esempio:
curl --socks5-gssapi-service sockd --socks5 hostname:4096 https://example.com 
--socks5-gssapi Use GSS-API authentication with a SOCKS5 proxy.

Esempio:
curl --socks5-gssapi --socks5 hostname:4096 https://example.com 
--socks5-hostname <host[:port]> Specify the SOCKS5 proxy to use.

Esempio:
curl --socks5-hostname proxy.example:7000 https://example.com 
--socks5 <host[:port]> Specify the SOCKS5 proxy to use. The hostname is resolved locally.

Esempio:
curl --socks5 proxy.example:7000 https://example.com 
-Y, --speed-limit <speed> Set the lower limit for the download speed.

Esempio:
curl --speed-limit 300 --speed-time 10 https://example.com 
-y, --speed-time <seconds> Set the time period for the speed limit measurement.

Esempio:
curl --speed-limit 300 --speed-time 10 https://example.com 
--ssl-allow-beast Tell curl to ignore the BEAST security flaw in the SSL3 and TLS1.0 protocols.

Esempio:
curl --ssl-allow-beast https://example.com 
--ssl-auto-client-cert Obtain and use a client certificate automatically.

Esempio:
curl --ssl-auto-client-cert https://example.com 
--ssl-no-revoke Do not check for certificate revocation.

Esempio:
curl --ssl-no-revoke https://example.com 
--ssl-reqd Require SSL/TLS.

Esempio:
curl --ssl-reqd ftp://example.com 
--ssl-revoke-best-effort Ignore certificate revocation checks if they failed because of missing distribution points.

Esempio:
curl --ssl-revoke-best-effort https://example.com 
--ssl Attempt to use SSL.

Esempio:
curl --ssl pop3://example.com/ 
-2, --sslv2 Use SSLv2. Newer curl versions ignore this request due to security concerns with SSLv2.

Esempio:
curl --sslv2 https://example.com 
-3, --sslv3 Use SSLv3. Newer curl versions ignore this request due to security concerns with SSLv3.

Esempio:
curl --sslv3 https://example.com 
--stderr <file> Output stderr to a file. The - symbol tells curl to output stderr to stdout.

Esempio:
curl --stderr output.txt https://example.com 
--styled-output Enable bold fonts for HTTP header terminal output.

curl --styled-output -I https://example.com 
--suppress-connect-headers Prevent curl from outputting CONNECT headers.

Esempio:
curl --suppress-connect-headers --include -x proxy https://example.com 
--tcp-fastopen Enable TCP Fast Open.

Esempio:
curl --tcp-fastopen https://example.com
--tcp-nodelay Enable TCP_NODELAY.

Esempio:
curl --tcp-nodelay https://example.com 
-t, --telnet-option <opt=val> Pass the TTYPE , XDISPLOC , and NEW_ENV options to the telnet protocol.

Esempio:
curl -t TTYPE=vt100 telnet://example.com/ 
--tftp-blksize <value> Set the value of TFTP BLKSIZE. Must be a value larger than 512.

Esempio:
curl --tftp-blksize 1024 tftp://example.com/file 
--tftp-no-options Prevents curl from sending requests for TFTP options.

Esempio:
curl --tftp-no-options tftp://192.168.0.1/ 
-z, --time-cond <time> Request a document that was modified after a certain date and time. For documents modified before the time, prefix the date expression with a dash.

Esempio:
curl -z "Wed 01 Sep 2021 12:18:00" https://example.com 
--tls-max <VERSION> Specify the newest TLS version that is supported.

Esempio:
curl --tls-max 1.2 https://example.com 
--tls13-ciphers <ciphersuite list> Specifies the list of cipher suites to use in negotiating TLS 1.3

Esempio:
curl --tls13-ciphers TLS_AES_128_GCM_SHA256 https://example.com 
--tlsauthtype <type> Specify the TLS authentication type.

Esempio:
curl --tlsauthtype SRP https://example.com 
--tlspassword <string> Specify the TLS password.

Esempio:
curl --tlspassword pwd --tlsuser user https://example.com 
--tlsuser <name> Specify the TLS username.

Esempio:
curl --tlspassword pwd --tlsuser user https://example.com 
--tlsv1.0 Tell curl to use TLS1.0 or newer.

Esempio:
curl --tlsv1.0 https://example.com 
--tlsv1.1 Tell curl to use TLS1.1 or newer.

Esempio:
curl --tlsv1.1 https://example.com 
--tlsv1.2 Tell curl to use TLS1.2 or newer.

Esempio:
curl --tlsv1.2 https://example.com 
--tlsv1.3 Tell curl to use TLS1.3 or newer.

Esempio:
curl --tlsv1.3 https://example.com 
-1, --tlsv1 Specify that curl should use at least 1.x version of TLS.

Esempio:
curl --tlsv1 https://example.com 
--tr-encoding Ask for a compressed Transfer-Encoding response.

Esempio:
curl --tr-encoding https://example.com 
--trace-ascii <file> Enable a full trace dump to a file. Eliminates the hex part and shows only ASCII.

Esempio:
curl --trace-ascii log.txt https://example.com 
--trace-time Require a time stamp on each trace or verbose line.

Esempio:
curl --trace-time --trace-ascii output https://example.com 
--trace <file> Enable a full trace dump to a file.

Esempio:
curl --trace log.txt https://example.com 
--unix-socket <path> Specify a Unix socket path.

Esempio:
curl --unix-socket socket-path https://example.com 
-T, --upload-file <file> Upload a file to the URL.

Esempio:
curl -T "img[1-1000].png" ftp://ftp.example.com/ 
--url <url> Provide a URL to be fetched.

Esempio:
curl --url https://example.com 
-B, --use-ascii Enable ASCII transfer.

Esempio:
curl -B ftp://example.com/README 
-A, --user-agent <name> Specify the user agent name.

Esempio:
curl -A "Agent 007" https://example.com 
-u, --user <user:password> Provide the username and password for authentication.

Esempio:
curl -u user:secret https://example.com 
-v, --verbose Tell curl to be verbose.

Esempio:
curl --verbose https://example.com 
-V, --version See the installed versions of curl and libcurl.

Esempio:
curl --version 
-w, --write-out <format> Tell curl to show information about the completed transfer on stdout.

Esempio:
curl -w '%{http_code}\n' https://example.com 
--xattr Store file metadata in file attributes.

Esempio:
curl --xattr -o storage https://example.com 

For comprehensive descriptions of the options, execute the curl --manual command in the terminal.


Ubuntu
  1. Comando sorgente Linux con esempi

  2. Comando di spegnimento di Linux spiegato con esempi

  3. Comando Traceroute di Linux, spiegato con esempi

  4. Comando JQ in Linux con esempi

  5. Comando Procinfo in Linux spiegato con esempi

Ordina il comando in Linux con esempi

Comando IP Linux con esempi

w Comando spiegato con esempi in Linux

Comando Linux Cat spiegato con esempi

Spiegazione del comando tee di Linux (con esempi)

Spiegazione del comando csplit di Linux (con esempi)