How to change user agent in wget

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

No comments yet. Be the first to leave a comment!

Leave a Comment

Your email address will not be published. Required fields are marked *