Skip to content

Instantly share code, notes, and snippets.

@AlexMunoz905
Last active May 5, 2021 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexMunoz905/737176c8b68236de68fd2cce666fe47a to your computer and use it in GitHub Desktop.
Save AlexMunoz905/737176c8b68236de68fd2cce666fe47a to your computer and use it in GitHub Desktop.
Bash Hostname Changer
#!/bin/bash
# Changes the hostname to what you specify.
# I made this for my ESXi VM templates.
echo -n "Set hostname to: ";
read hostname
sudo rm -rf /etc/hostname
echo $hostname >> hostname_temp
sudo cp hostname_temp /etc/hostname
rm -rf hostname_temp
echo "Hostname set to $hostname, please reboot for these changes to go into effect!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment