Courtesy of Pete in work. To enable hostname auto completion in Bash, do the following:
dig pop @dns.server.tld axfr | awk '$4 ~ /\yA\y/ && gsub(/.$/,"",$1) {print $1}' > ~/.hosts
If you would prefer to filter out hosts e.g. dev and swi, change awk to:
awk '$4 ~ /\yA\y/ && ! /dev/ && ! /swi/ && gsub(/.$/,"",$1) {print $1}'
Add the following to ~/.bashrc on linux:
export HOSTFILE=$HOME/.hosts complete -A hostname -o default dig host ping netcat curl ssh
Open a new terminal or source bash_profile, you should now be able to tab complete hostnames.