{"id":3839,"date":"2021-01-27T17:37:46","date_gmt":"2021-01-27T17:37:46","guid":{"rendered":"https:\/\/linuxways.net\/?p=3839"},"modified":"2021-01-27T17:39:50","modified_gmt":"2021-01-27T17:39:50","slug":"how-to-change-host-name-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-change-host-name-on-ubuntu-20-04\/","title":{"rendered":"How to Change Host Name on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction:<\/h2>\n<p>A system hostname is an entity that is used to uniquely identify a system within a network. It is also known as the device name of a system. This name is usually assigned to your system when you install an operating system on it. However, at times, you may feel like changing that previously set host name or device name for any reason. Therefore, today we will be learning all the different methods of changing your hostname on Ubuntu 20.04.<\/p>\n<h2>Methods of Changing the Hostname on Ubuntu 20.04:<\/h2>\n<p>For changing the Hostname on a Ubuntu 20.04 system, you can pick any method of your choice from the ones discussed below:<\/p>\n<h3>Method # 1: The GUI based Method for Changing the Hostname on Ubuntu 20.04:<\/h3>\n<p>To change the Hostname of your Ubuntu 20.04 system using the GUI based method, you will have to perform the following steps:<\/p>\n<h4>Step # 1: Access your Ubuntu 20.04 System\u2019s Settings:<\/h4>\n<p>First, you have to search for Settings in your Activities search menu and then click on the Settings search result as highlighted in the image shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"386\" height=\"235\" class=\"wp-image-3840\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-439.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-439.png 386w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-439-300x183.png 300w\" sizes=\"auto, (max-width: 386px) 100vw, 386px\" \/><\/p>\n<h4>Step # 2: Switch to the About Tab in the Settings Window and Click on the Current Device Name:<\/h4>\n<p>In the Settings window, you need to switch to the \u201cAbout\u201d tab. Here, you will be able to see an entry titled Device Name which in fact, refers to your hostname. You need to click on this entry to change it as highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"517\" class=\"wp-image-3841\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-440.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-440.png 729w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-440-300x213.png 300w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><\/p>\n<h4>Step # 3: Change your Hostname on Ubuntu 20.04:<\/h4>\n<p>When you will click on the Device Name entry, a dialogue box will appear on your screen. In this dialogue box, you can type in a new hostname in the space provided and then click on the Rename button as highlighted in the image shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"340\" height=\"196\" class=\"wp-image-3842\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-441.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-441.png 340w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-441-300x173.png 300w\" sizes=\"auto, (max-width: 340px) 100vw, 340px\" \/><\/p>\n<h4>Step # 4: Verify your Changed Hostname on Ubuntu 20.04:<\/h4>\n<p>Finally, you can verify the changed hostname by looking at the Device Name entry now as highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"481\" height=\"46\" class=\"wp-image-3843\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-442.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-442.png 481w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-442-300x29.png 300w\" sizes=\"auto, (max-width: 481px) 100vw, 481px\" \/><\/p>\n<h3>Method # 2: The \u201chostnamectl\u201d Command Method for Changing the Hostname on Ubuntu 20.04:<\/h3>\n<p>To change the Hostname of your Ubuntu 20.04 system using the \u201chostnamectl\u201d command method, you will have to perform the following steps:<\/p>\n<h4>Step # 1: Check the Current Hostname of your Ubuntu 20.04 System:<\/h4>\n<p>First, you need to check the current hostname of your Ubuntu 20.04 system with the command shown below:<\/p>\n<pre><strong>hostnamectl<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"377\" height=\"32\" class=\"wp-image-3844\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-443.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-443.png 377w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-443-300x25.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/strong><\/p>\n<p>The current hostname of our system is highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"514\" height=\"229\" class=\"wp-image-3845\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-444.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-444.png 514w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-444-300x134.png 300w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/><\/p>\n<h4>Step # 2: Change the Hostname of your Ubuntu 20.04 System using the \u201chostnamectl\u201d Command:<\/h4>\n<p>Now, we can change this hostname by executing the command shown below:<\/p>\n<pre><strong>hostnamectl set-hostname new-hostname<\/strong><\/pre>\n<p>Instead of new-hostname, you can type any new hostname of your choice as shown in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"27\" class=\"wp-image-3846\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-445.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-445.png 662w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-445-300x12.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/p>\n<h4>Step # 3: Verify your Changed Hostname on Ubuntu 20.04:<\/h4>\n<p>You can confirm if the hostname has been changed or not by executing the \u201chostnamectl\u201d command once again. From the output of this command, you can verify that the hostname of your Ubuntu 20.04 system has been changed as shown in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"536\" height=\"212\" class=\"wp-image-3847\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-446.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-446.png 536w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-446-300x119.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/p>\n<h3>Method # 3: The File based Method for Changing the Hostname on Ubuntu 20.04:<\/h3>\n<p>To change the Hostname of your Ubuntu 20.04 system using the file-based method, you will have to perform the following steps:<\/p>\n<h4>Step # 1: Change the Hostname in the \u201c\/etc\/hostname\u201d File on Ubuntu 20.04:<\/h4>\n<p>First, we need to access the \/etc\/hostname file with the following command:<\/p>\n<pre><strong>sudo nano \/etc\/hostname<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"485\" height=\"27\" class=\"wp-image-3848\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-447.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-447.png 485w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-447-300x17.png 300w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/strong><\/p>\n<p>This file will contain your current hostname as shown in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"152\" class=\"wp-image-3850\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-448.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-448.png 730w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-448-300x62.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>You can replace that hostname with any new hostname as shown in the following image and then you can save this file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"121\" class=\"wp-image-3851\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-449.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-449.png 726w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-449-300x50.png 300w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><\/p>\n<h4>Step # 2: Change the Hostname in the \u201c\/etc\/hosts\u201d File on Ubuntu 20.04:<\/h4>\n<p>Now, we need to access the \/etc\/hosts file with the command shown below:<\/p>\n<pre><strong>sudo nano \/etc\/hosts<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"460\" height=\"29\" class=\"wp-image-3852\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-450.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-450.png 460w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-450-300x19.png 300w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/strong><\/p>\n<p>This file contains the IP addresses corresponding to hostnames as shown in the following image. You can locate the hostname that you wish to change.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"236\" class=\"wp-image-3853\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-451.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-451.png 731w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-451-300x97.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p>Now, type in a new hostname at the located spot as highlighted in the image shown below after which you can save this file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"106\" class=\"wp-image-3854\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-452.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-452.png 726w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-452-300x44.png 300w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><\/p>\n<h4>Step # 3: Reboot your Ubuntu 20.04 System:<\/h4>\n<p>For the changes that you have just made to take effect, you have to reboot your Ubuntu 20.04 system with the following command:<\/p>\n<pre><strong>sudo systemctl reboot<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"27\" class=\"wp-image-3855\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-453.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-453.png 472w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-453-300x17.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/strong><\/p>\n<h4>Step # 4: Verify your Changed Hostname on Ubuntu 20.04:<\/h4>\n<p>Once your system is rebooted, you can verify your changed hostname by executing the \u201chostnamectl\u201d command yet again. The output of this command will reveal that your hostname has been changed successfully as shown in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"495\" height=\"213\" class=\"wp-image-3856\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-454.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-454.png 495w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/01\/word-image-454-300x129.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/p>\n<h2>Conclusion:<\/h2>\n<p>In this article, we shared with you both the CLI and GUI based methods of changing the hostname on Ubuntu 20.04. You can pick any method out of these as per your preferences. However, an important point to be noted over here is that the hostname or device name does not refer to your user account name and it will remain unchanged no matter which of these methods you choose to follow.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction: A system hostname is an entity that is used to uniquely identify a system within a network. It is also known as the device name of a&hellip;<\/p>","protected":false},"author":3,"featured_media":3849,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[158,100],"class_list":["post-3839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-host-name","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/3839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=3839"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/3839\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/3849"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=3839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=3839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=3839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}