CURL Linux commands

Estimated read time 2 min read

I must confess part of this blog post has been lingering in my drafts for quite some time. Despite a prolonged hiatus from writing, I’ve decided to take a shot at it now. So, let’s delve into the world of curl.

curl (transfer a URL) is a tool to transfer data from or to a server, using one of the supported protocols (DICT,
SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP
posts, SSL connections, cookies, file transfer resume, Metalink, and more. Let’s see a bunch of CURL commands to perform a specific test

1. Output the content of a webpage using curl

curl -o tunnelix.html

2. Display the header of a webpage

curl - I

3. Follow redirection on the HTTPS website and allow an insecure server connection

curl -IL -k

4. Testing a website locally and checking on which URL it is redirecting. “-k” is ignoring TlS.

curl -I -H"Host:" -k 

5. Curl script to get response time locally on the server. This can be interesting if you might want to troubleshoot unknown website downtime. So let’s do some curl, whilst being on a server but resolving it from outside

curl -o /dev/null -s -w "Time:%{time_total} Status:%{http_code}" -k -H "" https://localhost/sitemap.xml

6. If you are on a host and you want to curl a specific URL on that host only, but there is a proxy. Curl by bypassing all proxies and ignoring the https

curl -iL https://ipaddressofhost/index.html --noproxy "*" --insecure

keeping it Short Simple, and Stupid, I’m gonna stop writing further stuff for today. Eventually, this blog post is going to be evolving as I am finding interesting CURL for myself. Always consult the CURL documentation when stuck!!


Nitin J Mutkawoa

Blogger at | Founding member of | An Aficionado Journey in Opensource & Linux – And now It's a NASDAQ touch!

You May Also Like

More From Author