curl/

curl: Request URL via proxy

It is possible to request a URL in curl via proxy server using -x flag:

curl -x http://127.0.0.1:8080 https://google.com

This will send CONNECT request to your proxy server 127.0.0.1:8080. CONNECT request will ask proxy server to tunnel TCP connection to the destination. This means that, for example, proxy server won’t verify SSL certificate.

To force curl to send regular GET request, use the following command:

curl --request-target https://google.com -x 127.0.0.1:8080 127.0.0.1:8080
| 21 Apr 2022

Prettify json output in curl

Install jq package:

sudo dnf install jq

Usage example:

curl -u key:x "https://api.com/users.json" | jq
| 1 Jan 2020