Linux change my hostname / computer system name
Q. I’m using Ubuntu Linux. How do I change my hostname or the machine name?
A.. You need to use hostname command, which is used to either set or display the current host or domain name of the system. This name is used by many of the networking programs to identify the machine.
Following instructions should work on both Debian and Ubuntu Linux systems.
Task: Display current hostname
Just type hostname command print the name of the system:
$ hostname
Output:
vivek-desktop.gite.in
Task: Change hostname
Set hostname to desktop.nixcraft.com:
# hostname desktop.nixcraft.com
# hostname
Output:
desktop.nixcraft.com
Task: Change hostname permanently
You need to edit a file called /etc/hostname:
# vi /etc/hostname
Set new hostname:
desktop.nixcraft.com
Save and close the file.
A note for Redhat / CentOS Linux users
If you are using CentOS or Fedora or Redhat (RHEL) Linux, see this FAQ.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- OpenBSD Change Hostname
- Linux display or change a pre-login message - /etc/issue file
- Linux: find out information about current domain name and host name
- Linux setting hostname and domain name of my server
- Configuring Linux Static DHCP Clients by Sending Host Name
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: debian, hostname, hostname_command, ubuntu



Recent Comments
Today ~ 3 Comments
Today ~ 57 Comments
Yesterday ~ 9 Comments
Yesterday ~ 7 Comments
Yesterday ~ 1 Comment