This article shows how to use the -U
(uppercase U) option to change the user agent in wget command.
Terminal
wget -U {user-agent} {location}
Change user agent in wget
The below command changes the wget
user agent to Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
.
Terminal
wget -U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)" https://mkyong.com
Default user agent in wget
The default user agent for wget is Wget/VERSION
.
Terminal
Wget/1.20.1
Note
Many websites have firewalls that are set, by default or through configuration, to block the default ‘wget’ user agent due to concerns regarding security and performance. However, it is possible to modify the user agent in order to bypass these security measures.
References
- GNU Wget
- MDN – User-Agent
- Wikipedia – GNU Wget
- cURL post JSON data on Windows
- cURL – Display request headers and response headers
The post How to change user agent in wget appeared first on Mkyong.com.