How to change hostname in Linux

Advertisement ∇

hostname, linux hostname, linux, computer tipsIf you are new to linux you probably will ask how to change the hostname of you computer. (A hostname is the unique name by which a network attached device is known on a network.) If you enter the wrong hostname during the installation, and you need to change the hostname, here is the solution:-

  • Edit file /etc/sysconfig/network using your favourite editor. In my case is nano. So i’ll enter nano /etc/sysconfig/network
  • Look for HOSTNAME=xxxxxx
  • Change the xxxx to the name you wish to set for your computer. (ex: HOSTNAME=techiecorner.com)
  • Save the file and restart the xinetd service. (ex: type service xinetd restart in your shell)
  • Done! You have just changed your hostname in Linux platform


Technorati Tags: , , , , ,

Share and Enjoy:
  • Reddit
  • BlinkList
  • del.icio.us
  • Digg
  • Fark
  • IndianPad
  • StumbleUpon
  • YahooMyWeb
Posted at February 12th, 2007 by chua

If you think this article helps you to solve your problem and clear your headache, feel free to buy me a drink :)

Related Post

2 Responses to “How to change hostname in Linux”

  1. Mathew Says:

    Sadly, this doesn’t work all the time. I’ve found that more often than not, the change doesn’t take effect despite restarting xinetd. Instead, the only way to make it happen has been to reboot the server. Not always, but most of the times that I’ve had to do this.

  2. ShakBec Says:

    Just type “hostname xxxxxx”

    where xxxxx is your pc’s name

Leave a Reply