cURL: Set User-Agent

When browser connects to a website, it includes a User-Agent string in its HTTP header.

Sometimes you may need to change User-Agent with curl to access some URL as a different browser.

This is a small note on how to set a custom User-Agent with curl from the command line in Linux.

Cool Tip: Check a website availability using curl! Read more →

Set User-Agent In cURL

Use the following syntax to set User-Agent in curl:

$ curl -A "<User-Agent>" <URL>


$ curl -A "Googlebot/2.1 (+"

More User-Agent strings can be found here.

Leave a Reply