A user agent is nothing but software agent that is acting on behalf of a user. 

Change user agent with curl

The syntax is as follows for the curl command:


curl -A "user-agent-name-here" url
curl --user-agent "user-agent-name-here" url
curl -H "User-Agent: user-Agent-Name-Here"

Curl set the user agent to "Firefox"

I am going to set user agent as “Firefox 59 on Windows NT 6.1”:


$ curl -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0"  url
$ curl -I -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0"  url

Curl Set User Agent to "Safari"

curl -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (K HTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" url

How to change user Agent with browser

You can always use Firefox, Safari or Chrome to set user agent. So no need to use the curl command.

How to change user agent in Google Chrome

1) Select More tools > Developer tools.

2) Now, select tiny menu icon on right side > choose More tools > Network conditions.


3) Uncheck the select automatically user agent checkbox and you will get drop down menu as follows.


4) The user agent string will be changed on the current tab and remains only active when the Developer Tools are kept open.

Was this answer helpful? 0 Users Found This Useful (0 Votes)