🖥️curl

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the curl command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                 ██████╗██╗   ██╗██████╗ ██╗     
#                ██╔════╝██║   ██║██╔══██╗██║     
#                ██║     ██║   ██║██████╔╝██║     
#                ██║     ██║   ██║██╔══██╗██║     
#                ╚██████╗╚██████╔╝██║  ██║███████╗
#                 ╚═════╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝
                                                 
                                                
# Download a single file
curl http://path.to.the/file

# Download a file and specify a new filename
curl http://example.com/file.zip -o new_file.zip

# Download multiple files
curl -O URLOfFirstFile -O URLOfSecondFile

# Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg

# Download a file and pass HTTP Authentication
curl -u username:password URL 

# Download a file with a Proxy
curl -x proxysever.server.com:PORT http://addressiwantto.access

# Download a file from FTP
curl -u username:password -O ftp://example.com/pub/file.zip

# Get an FTP directory listing
curl ftp://username:[email protected]

# Resume a previously failed download
curl -C - -o partial_file.zip http://example.com/file.zip

# Fetch only the HTTP headers from a response
curl -I http://example.com

# Fetch your external IP and network info as JSON
curl http://ifconfig.me/all/json

# Limit the rate of a download
curl --limit-rate 1000B -O http://path.to.the/file

# POST to a form
curl -F "name=user" -F "password=test" http://example.com

# POST JSON Data
curl -H "Content-Type: application/json" -X POST -d '{"user":"bob","pass":"123"}' http://example.com

# POST data from the standard in / share data on sprunge.us
curl -F 'sprunge=<-' sprunge.us

#==============================#
# CMD CURL
#==============================##==============================#

10 Example of curl command in Linux
# Here are some of the useful examples of curl command in Linux. You can use this command to test your REST API from the Linux command line. You can also check if your web application is up and down by using curl command in a script and then running it from crontab or a scheduling application like Autosys.

1) How to send HTTP request from UNIX
You can use curl or wget to send HTTP request from UNIX, as shown below:

curl http://google.com

# By default, curl uses GET method to send HTTP request. You can also use query parameters while connecting to web services using HTTP as shown below:
curl http://api.openweathermap.org/data/2.5/weather?id=2172797

# Do not forget to include URL inside single quotes if you include more than one query parameters. Why? because multiple query parameters are separated using & which has special meaning in the shell, to run the command in the background, by including it inside single quotes we use it literally, as shown below:
curl 'http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139'

2) How to provide timeout for HTTP request in UNIX
# Another interesting example of curl command is by using -m option. You can use curl -m option to provide a timeout for HTTP request. If server will not return any response within specified time period then curl will exit, as shown below
curl -m 3 'http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139'

# will wait for 3 seconds before timing out. BTW, -m is used for a couple of things in curl e.g. for the maximum number of redirects and maximum file size to download.

# Alternatively, you can use more verbose --max-time, --max-redirs and --max-filesize options. Worth noting is maximum time allowed for transfer is in seconds, which means -m 5 means 5 seconds. You can use this option to check whether your website or web service is responsive or not.

curl http://api.openweathermap.org/data/2.5/weather?id=2172797
# By default, curl uses GET method to send HTTP request. You can also use query parameters while connecting to web services using HTTP

curl 'http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139'
# Don't forget to include URL inside single quotes if you include more than one query parameters. Why? because multiple query parameters are separated using & which has special meaning in the shell, to run the command in the background, by including it inside single quotes we use it literally

curl -m 3 'http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139'
# How to provide timeout for HTTP request in UNIX
# Another interesting example of curl command is by using -m option. You can use curl -m option to provide a timeout for HTTP request. If server will not return any response within specified time period then curl will exit, as shown below will wait for 3 seconds before timing out. BTW, -m is used for a couple of things in curl e.g. for the maximum number of redirects and maximum file size to download.

3) How to send HTTP POST request from Linux
# You can send any type of HTTP request by using curl -X command in Linux. It allows you to specify HTTP methods other than GET, for example, following command will send HTTP POST request from linux command line:

curl -X POST http://api.openweathermap.org

# Since GET is the default method, you don't need to specify it but if you want to send other HTTP methods e.g. PUT or POST, you can use this option. Btw, what is the use of POST request without sending any data? Let's see our next example, which allows you to send data to the server using curl command.

4) How to send data using HTTP POST in UNIX
# You can also send POST request using curl -d option. -d is nothing but for data, which is sent as POST body. The data is expected to be URL-encoded.

curl -d 'lat=35&lon=139' http://api.openweathermap.org/data/2.5/weather

# This will send query parameters as a POST request. You can also use -d option multiple times to specify different data pieces e.g.

curl -d lat=35 -d lon=139 http://api.openweathermap.org/data/2.5/weather

# This will eventually be combined as -d 'lat=35&lon=139'. The -d option can also be used to submit HTML form data to the server. You can see The Linux command line:  A complete Introduction for more details on sending data using curl command.

# How to send HTTP post request from Linux using curl
#=====================================================#

5) How to send a file via HTTP POST in Linux
# If your data is large, you can keep them inside a file and tell curl the file name. It will transfer all that data using HTTP post request to the server, here is an example of sending a file using curl:

curl -d @requestData.txt http://api.openweathermap.org/data/2.5/weather

# The @ sign tells curl that whatever follows is a file name. BTW, the content of file must be URL encoded. You can also use --data instead of -d if you prefer the most verbose option.

6) How to send username password for authentication using curl
# You can use curl -u option to pass username and password for authentication. The -u option is a shortcut of --user option which specifies username and password for server authentication. If you using twitter, here is how you can update your status using curl command right from UNIX:

curl -u username:password -d status='curl is great' http://twitter.com/statuses/update.xml

# If you don't wish your password to be saved in the shell history, you can omit password part and curl will prompt for password when it tries to authenticate on the server. As I told earlier, -d instructs curl to use HTTP POST method to send a request and "status=.." will be sent as part of the request body. You can further read Practical guide to Linux command and shell editors to learn more about it.

The curl Command example in UNIX and Linux
===========================================

7) How to specify HTTP header using curl command in Linux
# You can specify HTTP header by using curl -H option. Since with web service you often deal with either JSON or XML rather than HTML, it makes sense to specify content-type as either "application/json" or "application/xml". You can do this using curl as shown in the following example:

curl -H "Accept: application/json" 'http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139'

# You can also use headers while sending data to server using HTTP post e.g.

curl -X PUT \
    -H 'Content-Type: application/json' \
    -d '{"id":"101", "description":"baby soap"}'
    http://localhost:8080/item/add

# One side tip, you can split your UNIX command into multiple lines by using \ (backslash). It makes your command more readable, especially if it's getting long.

8) How to view HTTP response header in Linux
# You can use the curl -i command to view response header in UNIX. Since API and WebService provider is increasingly using HTTP header to provide information about caching, content-type, authorization etc, it's very useful to see HTTP header using curl as shown below:

curl -i http://api.openweathermap.org/data/2.5/weather?zip=94040,us

# This will return all response headers from HTTP response as shown below:

10 Examples of curl Command in UNIX and Linux
===============================================

# That is all about how to use curl command to send HTTP request and receive a response. We have seen several examples of curl command ranging from sending simple HTTP request to timeout, with query parameters and different types of HTTP request e.g. POST, PUT, and DELETE.

# It is actually a must know tool if you are working with REST web services which return JSON or XML output. You can test your web services right from UNIX box, can build scripts to test and monitor them as well. As a Java developer, I use curl a lot when I work with web services based application.

# UNIX command to send HTTP GET request
#-------------------------------------#
# Here is one example of calling web service from Linux shell by sending HTTP GET request using cURL command:

curl http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f
{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"base":"stations","main":{"temp":282,"pressure":1022,"humidity":87,"temp_min":277.15,"temp_max":285.15},"visibility":10000,"wind":{"speed":1.5},"clouds":{"all":90},"dt":1445577409,"sys":{"type":1,"id":5093,"message":0.0201,"country":"GB","sunrise":1445582275,"sunset":1445619056},"id":2643743,"name":"London","cod":200}

# You can also specify timeout using -m option as shown below:
curl -m 2 http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f

# This request will timeout in 2 seconds if it doesn't receive any response.

# You can also use wget to send HTTP request and download the data. Only difference between curl and wget is that curl will print output in console and wget will store it in the file e.g.

wget http://localhost:8080/index.html

#will download the content of index.html and store into a file with the same name.

#Here is how you can use curl to download wget command in UNIX:
#How to send HTTP request from UNIX? Use CURL command

# UNIX command to send HTTP POST request
#----------------------------------------'
# You can also use curl to send HTTP post request. All you need to do is use the --data option to specify the data you want to POST to web service e.g.
curl --data "param1=value1&param2=value2" http://locahost:8080/weather

# if you want to send a data from file to web service, you can also use the following command:
curl -X POST -d @filename http://locahost:8080/weather

# Similarly, if you want to upload a file you can do so by executing the following command:
curl --form "[email protected]" http://locahost:8080/weather

#######################

#  UNIX command to send HTTP GET request
##########################################
# Here is one example of calling web service from Linux shell by sending HTTP GET request using cURL command:

curl http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f
{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"base":"stations","main":{"temp":282,"pressure":1022,"humidity":87,"temp_min":277.15,"temp_max":285.15},"visibility":10000,"wind":{"speed":1.5},"clouds":{"all":90},"dt":1445577409,"sys":{"type":1,"id":5093,"message":0.0201,"country":"GB","sunrise":1445582275,"sunset":1445619056},"id":2643743,"name":"London","cod":200}

# You can also specify timeout using -m option as shown below - This request will timeout in 2 seconds if it does not receive any response.
curl -m 2 http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=bd82977b86bf27fb59a04b61b657fb6f

# You can also use wget to send HTTP request and download the data. Only difference between curl and wget is that curl will print output in console and wget will store it in the file e.g.

wget http://localhost:8080/index.html
# will download the content of index.html and store into a file with the same name.

# How to send HTTP request from UNIX? Use CURL command
#-------------------------------------------------------

# UNIX command to send HTTP POST request - You can also use curl to send HTTP post request. All you need to do is use the --data option to specify the data you want to POST to web service e.g.
curl --data "param1=value1&param2=value2" http://locahost:8080/weather

# if you want to send a data from file to web service, you can also use the following command:
curl -X POST -d @filename http://locahost:8080/weather

# Similarly, if you want to upload a file you can do so by executing the following command:
curl --form "[email protected]" http://locahost:8080/weather

curl -s http://www.coindesk\.com/price/ |grep bpiUSD |sed 's/<\/\?[^>]\+>//g' |tr -d " \t\r" 
# bitcoin prices in USD. 

curl -I http://langs.eserver\.org/latin-terms.txt | grep Last-Modified
# Check the last modified date of a file on a web server.

curl -sI https://www.nianticlabs\.com/privacy/pokemongo/en/ | head -1
# Show the HTTP response code for a URL. Catch it while you can!

curl wttr\.in/Moon
# See the current phase of the moon in your terminal. New feature of wttr.in

curl -d "" http://YourRokuIP:8060/keypress/Pause
# Press pause on your Roku. [When your kids lose the remote]

curl -sr 0-1024 www.nasa\.gov/images/content/618486main_earth_full.jpg |strings
# View image metadata without downloading whole 16MB image

curl -H "Host: http://www.example.com " http://example.climagic\.org/config.php
# Change the host header to bypass the DNS.

curl -s https://www.drownattack\.com/top-sites |html2text|awk -F\. '/^[0-9]+/{print $NF}' |sort|uniq -c|sort -nr
# Drownattack TLD stats

curl ipinfo.io
# The below command will output the ‘Geographical Location‘ of the IP address, provided.

curl ifconfig.me
# So how do you obtain your External IP address? Using google?. Well the command output your external IP address right into your terminal.

curl -u [email protected] --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'
# How about checking your unread mail from the command line. This command is very useful for those who work on headless server. Again it asks for password at run time and you need not hard code your password in the above line, which is otherwise a security risk.

curl -Ns http://www.climagic\.org/uxmas/[1-14] 
# curl supports numeric ranges. This is the full 14 days of unix-mas from 2012.

curl -v telnet://blt.evedder\.otv:4240
# Don not have telnet, netcat, etc installed. You can use curl with telnet:// prefix. 

# Yeah, so with their API it would just be 
curl https://api.coindesk.com/v1/bpi/currentprice.json  | jq .bpi.USD.rate

curl -d "" http://YourRokuIP:8060/keypress/InstantReplay
# Do an instant replay on your Roku.

# BTW, if you are only getting HTML back, try curl -4 http://wttr\.in/
finger [email protected]
curl http://wttr\.in/dallas

# Show the HTTP response code for a URL. Catch it while you can!
curl -sI https://www.nianticlabs\.com/privacy/pokemongo/en/ | head -1

curl -I http://langs.eserver\.org/latin-terms.txt | grep Last-Modified
# Check the last modified date of a file on a web server.

curl wttr\.in/Moon
# See the current phase of the moon in your terminal. New feature of wttr.in

curl -d "" http://YourRokuIP:8060/keypress/Pause
# Press pause on your Roku. [When your kids lose the remote]

curl -sr 0-1024 www.nasa\.gov/images/content/618486main_earth_full.jpg |strings
# View image metadata without downloading whole 16MB image

curl -H "Host: http://www.example.com " http://example.climagic\.org/config.php
# Change the host header to bypass the DNS.

curl -F password=@/etc/passwd http://www.mypasswords.com 
# Bad man page examples: For example, to send your password file to the server.... 

curl -s https://www.drownattack\.com/top-sites |html2text|awk -F\. '/^[0-9]+/{print $NF}' |sort|uniq -c|sort -nr
# Drownattack TLD stats

curl -N --limit-rate 16K http://f.climagic\.org/techsup.mp3 | mpg123 -
# Stream mp3 at bitrate speed (128Kbits). WARNING: NSFW "lyrics"

curl 'http://web.host/IMG_0[001-105].jpg …' -o "trip#1.jpg"
# Download images named IMG_0001.jpg through IMG_0105.jpg and save with different name.

# bitcoin prices in USD. 
curl -s http://www.coindesk\.com/price/ |grep bpiUSD |sed 's/<\/\?[^>]\+>//g' |tr -d " \t\r" 

curl -sI http://www.w3\.org/History/1989/proposal.rtf |grep Last-Modified
# See an earlier version date for TBLs WWW proposal. #QuestionAll

curl -Ls http://climagic\.org/uxmas/14

curl -v telnet://blt.evedder\.otv:4240
# Don not have telnet, netcat, etc installed. You can use curl with telnet:// prefix. 

curl -N --limit-rate 16K http://f.climagic\.org/techsup.mp3 | mpg123 -
# Stream mp3 at bitrate speed (128Kbits). WARNING: NSFW "lyrics"

curl -F password=@/etc/passwd http://www.mypasswords.com 
# Bad man page examples: For example, to send your password file to the server.... 

curl -4 http://wttr\.in/
# BTW, if you are only getting HTML back, try 

curl http://wttr\.in/dallas

curl 'http://web.host/IMG_0[001-105].jpg …' -o "trip#1.jpg"
# Download images named IMG_0001.jpg through IMG_0105.jpg and save with different name.

curl -sI http://www.w3\.org/History/1989/proposal.rtf |grep Last-Modified
# See an earlier version date for TBLs WWW proposal. #QuestionAll

# Bonus: Here are some of the commands that I used to create the cheat sheet:
curl 'http://www.gnu.org/software/coreutils/manual/coreutils.html' 2>/dev/null |
    grep 'h3 class' |
    grep 'class="command"' |
    sed 's/.*class="command">//' |
    sed 's|</span></samp>||' |
    sed 's|</h3>||' |
    grep ':' |
    sort

curl http://wttr.in/Berlin?lang=de
# Wetterbericht Berlin

URL="http://www.google.com";curl -L --w "$URL\nDNS %{time_namelookup}s  conn %{time_connect}s  time %{time_total}s\nSpeed %{speed_download}bps Size %{size_download}bytes\n" -o/dev/null -s $URL
# How fast is the connexion to a URL, some stats from curl

curl ifconfig.me
# What is my public IP-address?

curl ipinfo.io
# return external ip

curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g'
# Get your external IP address

curl -X POST -d @filename.txt http://example.com/path/to/resource --header "Content-Type:text/xml"
# How to use curl to send HTTP POST using file - Using curl you can send POST request, putting the content of your request in a separated file. For a RESTful HTTP POST containing XML
#    or for JSON, use this:
curl -X POST -d @filename.txt http://example.com/path/to/resource --header "Content-Type:application/json"
# This will read the contents of the file named filename.txt and send it as the post request.
#    Usage options:
#         -d: <filename> where some contents t o post
#         --header : specify the content type of your request (eg json/xml/text)

curl -v -L -G -d "q=test&sort=0&direction=1" https://www.snip2code.com/Explore/InChannel  
# curl to send a GET HTTP request with query parameters - Try to perform a GET HTTP to snip2code server, to list the public snippets in Channels. URL example to get: https://www.snip2code.com/Explore/InChannel?q=test&sort=0&direction=1
#    Options:
#         -d: list all query parameters
#         -G: perform GET verb

curl -sI http://imgs.xkcd.com/comics/i_know_youre_listening.png … | grep Last-Modified 
# Check the last modified date of a file over HTTP.

o=$(curl -Ls bit\.ly/globe_vt);yes "$o"|perl -ne '$/="\e[H";$\=$/;print "$_";select(undef,undef,undef,1/24);' 
# One world, no pv version.

oneworld=$( curl -Ls http://bit\.ly/globe_vt );while sleep .1;do pv -L4220 -q <<<"$oneworld";done 
# ASCII globe animation

curl http://wttr.in/Prague  
# Check the weather for the next few days in Prague. ;-)

curl -d '' http://roku\.home:8060/keypress/Up 
# Move up in your Roku interface. Great for when you can't find the remote. 

curl <addr1> --resolve <addr2> 
# resolve address 1 to address 2. Useful for testing

# Curl command with examples 
###########################

# Download or visit a single URL -> To download a file using CURL from http or ftp or any other protocol, use the following command
curl http://linuxtechlab.com

# If curl can’t identify the protocol being used, it will switch to http. We can also store the output of the command to a file with ‘-o’ option or can also redirect using ‘>’,
curl http://linuxtechlab.com -o test.html , or,

curl http://linuxtechlab.com > test.html

# Download multiple files -> To download two or more files with curl in a single command, we will use ‘-O’ option. Complete command is,
curl -O http://linuxtechlab.com/test1.tar.gz -O http://linuxtechlab.com/test2.tar.gz

# Using ftp with curl -> To browse a ftp server, use the following command,
curl ftp://test.linuxtechlab.com –user username:password

# To download a file from the ftp server, use the following command,
curl ftp://test.linuxtechlab.com/test.tar.gz –user username:password -o test.tar.gz

# To upload a file to the ftp server using th curl command, use the following,
curl -T test.zip ftp:/test.linuxtechlab.com/test_directory/ –user username:password

# Resume a paused download -> We can also pause and resume a download with curl command. To do this, we will first start the download ,
curl -O http://linuxtechlab.com/test1.tar.gz

# than pause the download using ‘ctrl+C’ & to resume the download, use the following command, here, ‘-C’ option is used to resume the download.
curl -C – -O http://linuxtechlab.com/test1.tar.gz
 

# Sending an email -> Though you might not be using it any time soon, but none the less we can use curl command to send email. Complete command for sending an email is,
curl –url “smtps://smtp.linuxtechlab.com:465” –ssl-reqd –mail-from “[email protected]” –mail-rcpt “[email protected]” –upload-file mailcontent.txt –user “[email protected]:password” –insecure

# Limit download rate -> To limit the rate at which a file is downloaded, in order to avoid network choking or for some other reason, use the curl command with ‘–limit-rate’ option,
curl –limit-rate 200k -O http://linuxtechlab.com/test.tar.gz
 

# Show response headers -> To only see the response header of a URL & not the complete content , we can use option ‘-I’ with curl command, This will only show the headers like http protocol, Cache-contorol headers, content-type etc of the mentioned url.
curl -I http://linuxtechlab.com/

# Using http authentication -> We can also use curl to open a web url that has http authentication enabled with curl using ‘-u ‘ option. Complete command is,
curl -u user:passwd http://linuxtechlab.com

# Using a proxy -> To use a proxy server when visiting an URL or downloading, use ‘-x’ option with curl,
curl -x squid.proxy.com:3128 http://linuxtechlab.com

# Verifying Ssl certificate -> To verify a SSL certificate of an URL, use the following command,
curl –cacert ltchlb.crt https://linuxtechlab.com

# Ignoring SSL certificate -> To ignore the SSL certificate for an URL, we can use ‘-k’ option with curl command,
curl -k https://linuxtechlab.com

# git clone all user repos
curl -s https://api.github.com/users/tuxcanfly/repos | jq -r 'map(select(.fork == false)) | map(.url) | map(sub("https://api.github.com/repos/"; "git clone [email protected]:")) | @sh' | xargs -n1 sh -c]

# If you use Linux, you should totally run 
curl http://parrot.live

# Count the number of 3+ letter TLDs 
curl -s https://data.iana.org/TLD/tlds-alpha-by-domain.txt … | egrep "^[^#]{3,}" | wc -l 

# Country code counts of IEEE OUIs.
curl http://standards-oui.ieee.org/oui.txt  | dos2unix | grep '^\s\+[A-Z][A-Z]$' | sort | uniq -c | sort -n

# One nice feature of curl is that it can do more than just HTTP and FTP. You can use it like a generic TCP client when a better tool like nc isn't available.
curl telnet://host.example.com:1093 

curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | awk -F'"' '/ip_prefix/ {print $4}'
# get all Amazon cloud (amazonws etc) ipv4 subnets

curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | awk -F'"' '/ipv6_prefix/ {print $4}'
# get all Amazon cloud (amazonws etc) ipv6 subnets

curl https://www.domain.com/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*.*(doc|docx|xls|xlsx|ppt|pptx|pdf)" | sort | uniq > list.txt | wget list.txt
# Get all documents (doc,docx,xls,xlsx,pdf,ppt,pptx,...) linked in a webpage

curl http://www.google.com/azerty  | grep title 
# Google's 404 error page has a "typo" in the title tag, suggesting someone haphazardly typed in the title text. They thought you weren't looking!!1 ;)

# Download all files from a Github gist individually - Downloads each file from a github gist individually. - Requires jq ( https://stedolan.github.io/jq/ ).
curl -sS --remote-name-all $(curl -sS https://api.github.com/gists/997ccc3690ccd3ac5196211aff59d989 | jq -r '.files[].raw_url')

curl --remote-name 'http://www.example\.com/images/IMG_[0001-0176].JPG' 
# Download images in sequence IMG_0001.JPG through IMG_0176.JPG

curl -L https://twitter.com/i/web/status/1141450840013754369 | egrep -o ".{0,500}find with prune.{0,500}" # On the web you can encounter some extremely long lines of HTML code. Using a regex like .{0,500} and grep's -o option can help capture just the context around something you're searching for.

curl -s -L t\.co/YG3gLKwG9G | grep -o -P '(?<=<meta\ \ property="og:description" content="“).*(?=”">)' # GET the tweet, the full tweet and nothing but the tweet.This uses Perl regex lookahead/behind regex black magic.

# Print all git repos from a user - Python is installed on many boxes (in case you could not afford installing jq).
curl -s "https://api.github.com/users/<username>/repos?per_page=1000" | python <(echo "import json,sys;v=json.load(sys.stdin);for i in v:; print(i['git_url']);" | tr ';' '\n')

# Print all git repos from a user - in case you could afford installing jq
curl -s "https://api.github.com/users/<username>/repos?per_page=1000" | jq '.[].git_url'

# Print all git repos from a user
curl -s https://api.github.com/users/<username>/repos?per_page=1000 |grep git_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/'

# Ultra fast public IP address lookup using Cloudflare's 1.1.1.1
curl -fSs https://1.1.1.1/cdn-cgi/trace | awk -F= '/ip/ { print $2 }'

# Get your public IP address using Amazon
curl checkip.amazonaws.com

curl -d '{"username": "Zach", "password": "something"}' -H "Content-Type: application/json" -X POST "localhost/api/login"
	# Similar to what we've done before. This time I get back the following:
		{"success": true, "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImp0aSI6Ijg4NGU1ZDI1LTM5MjMtNGM5OS1hMWE5LTBhYjhiY2I1NGI0NiIsImlhdCI6MTU1ODkwNTM3MSwiZXhwIjoxNTU4OTA4OTcxfQ.-5p5Wjk9k9y9Yf-pY0bnd6tOEAJyRKgb9DDzt4GoYIk"}

# We specify it as the argument of ".token" for jq because that's the name of the property whose value we want. What's the -r flag? It means I want the token given to me raw as text instead of as a string. When I pass/inject the TOKEN in my GET request,
curl -H "Accept: application/json" -H "Authorization: $TOKEN" -X GET "localhost/api/jokes"

#==============================##==============================#
# CMD curl						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░