Created
February 23, 2022 12:13
-
-
Save xiongnemo/023a62de988a4d8dc032c7b7323b6582 to your computer and use it in GitHub Desktop.
Change Linux hostname (root) (https://www.cyberciti.biz/faq/ubuntu-change-hostname-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
#!/bin/sh | |
# $1: new hostname | |
hostname $1 | |
echo $1 > /etc/hostname | |
echo "127.0.1.1 "$1 >> /etc/hosts | |
hostnamectl set-hostname $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment