Created
February 8, 2022 06:39
-
-
Save Esonhugh/c981d6209daa037c6bc5904e384bd0d0 to your computer and use it in GitHub Desktop.
covert the dnsmasq format ip hosts to hosts file command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export your_domain=Whoami.dn42 # or .local .localdomain ...etc | |
cat /etc/dnsmasq.conf |grep $your_domain |grep address |cut -d "/" -f 2,3 |sed -e "s/\//\t/g" |awk '{print $2 "\t" $1}' | |
## from dnsmasq to hosts | |
cat /etc/dnsmasq.conf |grep $your_domain |grep address |cut -d "/" -f 2,3 |sed -e "s/\//\t/g" |awk '{print $2 "\t" $1}' |tee -a /etc/hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment