Changing hostname in ubuntu

Recently, we wanted to change the hostname of our ubuntu 15.10 / 16.04 machine,

$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily

Lets, check now what is current hostname,

$ hostname

new-hostname

So, its set to “new-hostname”

Now, to change the hostname lets say “my-netbook”, user the command as,

$ hostnamectl set-hostname my-netbook

Now, open a new terminal and verify that its changed,

$ hostname

my-netbook

So, its now changed 🙂

In certain case, using sudo you might get an error like “unable to reolve host” to resolve this follow “How to Fix : sudo: unable to resolve host my_user: No such file or directory”

Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded
Tags:

Leave a Reply