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,
FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP,
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 https://tunnelix.com -o tunnelix.html

2. Display the header of a webpage

curl - I http://www.tunnelix.com

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

curl -IL -k https://www.tunnelix.com

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

curl -I -H"Host: www.tunnelix.com" https://127.0.0.1 -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 "HOST:tunnelix.com" 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 https://tunnelix.com

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

You May Also Like

More From Author