• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to change hostname in Ubuntu 12.04 and 12.10 without system restart

July 15, 2012 by Sharad Chhetri

In this post learn,how to change hostname in Ubuntu 12.04 and 12.10 without system restart.
Here, there are few steps through which we can change the hostname of system without reboot.

System OS: Ubuntu 12.04 LTS n l

Follow steps to change hostname in Ubuntu 12.04 LTS and Ubuntu 12.10

Step 1: Edit the /etc/hosts file and give the hostname which you want.
We have added the new line 127.0.1.1 tuxworld, this is our system new hostname.

root@mymachine:~$sudo vi /etc/hosts
127.0.0.1	localhost
127.0.1.1	tuxworld

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
191.168.122.26
root@mymachine:~$

Step 2: Now edit /etc/hostname and give the hostname you want. You can see here, we have given hostname as “tuxworld”.

root@mymachine:~$sudo  vi /etc/hostname
tuxworld
root@mymachine:~$

Step 3: Restart the /etc/init.d/hostname.sh (In Ubuntu 12.04)

/etc/init.d/hostname.sh restart

OR

Restart the /etc/init.d/hostname (In Ubuntu 12.10)

/etc/init.d/hostname restart

Step 4: Exit from the terminal and reopen once again.
You can also logout and login back to see the changes.

Step 5: Use hostname command to check hostname of system. This is how you can verify at the end.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Set hostname and FQDN in Ubuntu without reboot
  2. How to change hostname or FQDN in CentOS and Redhat
  3. How to set hostname and FQDN on CentOS 7 and RHEL 7
  4. SELINUX : squid service failed to start/restart
  5. How to start / stop / restart / reload iptables on CentOS 7 / RHEL 7
  6. Change default editor of crontab in Ubuntu
  7. Read the file inside compressed .gz files without extract
  8. Non interactive ,without typing password do ssh to Server : By sshpass
  9. Run the script using nohup without hitting enter key two times
  10. Edit the crontab without using crontab -e

Filed Under: Linux, Tips And Tricks Tagged With: hostname, ubuntu

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Linux Commands

How to make rm -fr command to be interactive

6 important examples of cd command on Linux and Unix Systems

Unix / Linux : How to print duplicate lines from file

How to lock and unlock user account in linux

How To Get SSH Public Key Fingerprint Information

Search Keyword In Man Page Like We Search In vi / vim Editor

How to extract RPM package on Linux system

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

Forward all incoming emails to other SMTP server or gateway

New XAMPP security concept

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

Forgot root password ,Reset it in Run level 1

How to change smtp port number 25 in postfix

sed: -e expression #1, char 24: Invalid range end

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands For Every Beginner

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy