Skip to content

Instantly share code, notes, and snippets.

@lenosi
Last active June 18, 2019 08:33
Show Gist options
  • Save lenosi/48b96c590ec38cac01434a74efa839ed to your computer and use it in GitHub Desktop.
Save lenosi/48b96c590ec38cac01434a74efa839ed to your computer and use it in GitHub Desktop.
Fix hostname address with FQDN
echo $(ifconfig eth0 | awk '$1 == "inet" {print $2}') \
$(nslookup $(ifconfig eth0 | awk '$1 == "inet" {print $2}') | \
awk '{ print $4; exit }') $(hostname) >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment