TIL: $HOSTALIASES in FreeBSD

Apparently you can set the $HOSTALIASES environment variable in FreeBSD (and maybe some Linuxen? but not OpenBSD AFAICT) to point to an alternate hosts file (instead of the default /etc/hosts) for re-mapping particular hosts. This would let you do something like

$ HOSTALIASES=$HOME/hosts.txt myprog

and any name-resolution that myprog(1) does will first consult the ~/hosts.txt file.

man.freebsd.org/cgi/man.cgi?qu

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.bsd.cafe/users/gumnos/statuses/115714606443018780 on your instance and quote it. (Note that quoting is not supported in Mastodon.)