It's not possible to use a wildcard in the hosts file on windows or linux. Is there a way to do it with a browser plugin or something else?
I have a dev server on a vbox instance so it's practically LAN. I'm creating .dev domain for my virtual hosts so example.com becomes example.dev. For an application I'm creating random subdomains (abd34dn.example.dev) which should all point to the dev server's IP.
What are my options?
Instead of editing hosts file (which does not work for your requirement), setup a DNS server and setup Wildcard DNS A record -- like
*.example.dev IN A 1.2.3.4
You mentioned subdomains, but I am assuming you actually want host entries (A address entries) under example.dev. Now abcd.example.dev indicates "abcd" is a host entry, and not a subdomain. Only if you say xyz.abcd.example.dev, then "abcd" becomes a subdomain. The key point is to say - since you want only abcd.example.dev - then you need only DNS A records and it is suggested as above.