Skip to content

Instantly share code, notes, and snippets.

@virullius
Created June 18, 2014 16:39
Show Gist options
  • Save virullius/da1c4f072c08a2ff0e19 to your computer and use it in GitHub Desktop.
Save virullius/da1c4f072c08a2ff0e19 to your computer and use it in GitHub Desktop.
Make hostname lowercase on linux
# set hostname to lower in /etc/hosts file
sed -i "s/$(hostname)/$(hostname | tr '[:upper:]' '[:lower:]')/" /etc/hosts
# set runtime hostname to lowercase
hostname $(hostname | tr '[:upper:]' '[:lower:]')
# save lowercase hostname to /etc/hostname file
hostname > /etc/hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment