Last active
May 11, 2020 01:50
-
-
Save donilan/67d38d263c21702447729d9084e51198 to your computer and use it in GitHub Desktop.
Update hostname, before execute this script, please export NEW_HOSTNAME=your.new.domain
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
#!/usr/bin/env bash | |
sudo hostname $NEW_HOSTNAME | |
hostname | sudo tee /etc/hostname | |
sudo sed -i -e "s/ $(hostname)//g" -e "/127.0.0.1/s/\$/ $(hostname)/" /etc/hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment