How to Set User Agent in cURL Command

The default user agent of the cURL command is something like 'curl/7.43.0'. But we can customize and set different user agent if we want.

To set curl user agent we use either --user-agent or -A option. Following example will use 'Mozilla/4.0 ' as the user curl agent.

curl --user-agent Mozilla/4.0

The following command will set curl user agent to the User-Agent found in the Windows Firefox web browser.

curl --user-agent 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0'

To verify the user agent, Type:

curl -v --user-agent Mozilla/4.0 |& grep -i User-Agent