• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How To Change System Hostname in Ubuntu Linux Without Restarting & Permanently

How To Change System Hostname in Ubuntu Linux Without Restarting & Permanently

By Sourabh / May 24, 2019 Category: How To, Ubuntu

How to change System Hostname in Ubuntu Linux. How to change the hostname of a Linux system without restarting. On Ubuntu, how to change Hostname via Command Line. Learn how to use hostname command in Ubuntu Linux to change Linux computer name.

Change System Hostname Without Restarting

hostname-ubuntu

Hostname command is used to display the system’s DNS name, and to display or set its hostname or NIS domain name. When hostname command is executed without any parameters, it displays the active hostname of the Linux Ubuntu system

$ hostname

If you want to change or set hostname of your Linux system, simply run:

$ hostname NEWNAME

Replace the NEWNAME with the desired hostname. When the anove command in executed it will immediately change the hostname of the system.

Please Note: It will not change the hostname permanently. It is only temporary and the original hostname will be restored after the next system restart.

Change System Hostname Permanently

If you want to change the system hostname permanently, you can use hostnamectl set-hostname command. The set-hostname command can be used in the following format:


$ sudo hostnamectl set-hostname NEW_HOSTNAME

hostnamectl

hostnamectl may be used to query and change the system hostname and related settings. This tool distinguishes three different hostnames: the high-level “pretty” hostname which might include all kinds of special characters (e.g. “Lennart’s Laptop”), the static hostname which is used to initialize the kernel hostname at boot (e.g. “lennarts-laptop”), and the transient hostname which is a fallback value received from network configuration. If a static hostname is set, and is valid (something other than localhost), then the transient hostname is not used.

Note that the pretty hostname has little restrictions on the characters used, while the static and transient hostnames are limited to the usually accepted characters of Internet domain names. The static hostname is stored in /etc/hostname, see hostname for more information. The pretty hostname, chassis type, and icon name are stored in /etc/machine-info, see machine-info.

hostname

hostname – show or set the system’s host name

hostname-alias

Usage:

hostname [-a|–alias] [-d|–domain] [-f|–fqdn|–long] [-A|–all-fqdns] [-i|–ip-address] [-I|–all-ip-addresses] [-s|–short] [-y|–yp|–nis] hostname [-b|–boot] [-F|–file filename] [hostname] hostname [-h|–help] [-V|–version] hostname [-b] {hostname|-F file} set host name (from file)
hostname [-a|-A|-d|-f|-i|-I|-s|-y] display formatted name hostname display host name
{yp,nis,}domainname {nisdomain|-F file} set NIS domain name (from file)
{yp,nis,}domainname display NIS domain name
dnsdomainname display dns domain name
hostname -V|–version|-h|–help print info and exit

Options:
-a, –alias alias names
-A, –all-fqdns all long host names (FQDNs)
-b, –boot set default hostname if none available
-d, –domain DNS domain name
-f, –fqdn, –long long host name (FQDN)
-F, –file read host name or NIS domain name from given file
-i, –ip-address addresses for the host name
-I, –all-ip-addresses all addresses for the host
-s, –short short host name
-y, –yp, –nis NIS/YP domain name

 

Tags: Hostname Command Linux, Hostname Command Ubuntu, How To Change Hostname In Linux 5, How To Change Hostname In Linux 7, How To Change Hostname In Linux Centos, How To Change Hostname In Linux Redhat, How To Change Hostname In Linux Server, How To Change Hostname In Linux Suse, How To Change Hostname In Linux Ubuntu, How To Change Hostname In Oracle Linux, How to Change System Hostname in Linux, How to Change System Hostname in Linux Without Restart, How to Change System Hostname in Ubuntu, How to Change System Hostname in Ubuntu Without Restart, How to Set System Hostname in Linux, How to Set System Hostname in Linux Without Restart, How to Set System Hostname in Ubuntu, How to Set System Hostname in Ubuntu Without Restart, Linux Hostname Command, Linux How to Change System Hostname, Linux How to Set System Hostname, Set System Hostname Permanently in Linux, Set System Hostname Permanently in Ubuntu, Set System Hostname Temporary in Linux, Set System Hostname Temporary in Ubuntu, Ubuntu Change Hostname Command Line, Ubuntu Hostname Command, Ubuntu How to Change System Hostname, Ubuntu How to Set System Hostname, Ubuntu Linux Change Hostname, Ubuntu Linux Computer Name

Primary Sidebar

Latest Posts

How To Run Fsck Manually In Linux To Fix Unexpected Inconsistency

How To Fix Broken Packages On Ubuntu From Terminal

Re Execute The Previous Command In Linux Ubuntu Command Line

How Much RAM Is Needed For Ubuntu PC

How To Find Large Files And Directories In Linux Command Line

How To Use Clear Command History In Linux Terminal

Linux Command To Check RAM Size In Ubuntu Terminal In GB

How To Install Proprietary Drivers In Linux Ubuntu Using Terminal

How To Shutdown Linux With A 15 Minute Delay And Message

Free AI Courses With Certificate For Beginners In India

© 2026 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap