{"id":2014,"date":"2013-10-26T07:01:07","date_gmt":"2013-10-26T07:01:07","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=2014"},"modified":"2021-09-22T16:59:47","modified_gmt":"2021-09-22T16:59:47","slug":"change-computer-name-hostname-ubuntu-13-10","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2013\/10\/change-computer-name-hostname-ubuntu-13-10\/","title":{"rendered":"How to Change Computer Name (aka hostname) in Ubuntu 21.10"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2021\/09\/gnome-icon1200.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/12\/gnome-icon250.png\" alt=\"\" width=\"250\" height=\"250\" class=\"alignleft size-thumbnail wp-image-33105\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/12\/gnome-icon250.png 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/12\/gnome-icon250-150x150.png 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>This simple tutorial shows you how to change the <b>hostname<\/b> (also known as <b>computer name<\/b>) in <b>Ubuntu 21.10<\/b> Impish Idri.<\/p>\n<p>The computer name is a unique identifier given to each computer. It&#8217;s not a big deal for small home networks or single use home computers. It matters however in larger organizations where you need to be able to identify servers. The name is a <b>single word with no spaces<\/b>, it has only letters, numbers or a hyphen with up to 253 characters.<\/p>\n<p>The default name was set during installing the Ubuntu system. You can however change it at anytime as you want. And here&#8217;s the universal way to do the trick in either Ubuntu desktop or server editions.<\/p>\n<h3>Tutorial Objectives:<\/h3>\n<ul>\n<li>Change Computer Name \/ Hostname in Ubuntu 21.10<\/li>\n<li>Enjoy!<\/li>\n<\/ul>\n<h3>Change computer name until reboot:<\/h3>\n<p>To get started, first either connect to your Ubuntu server or open terminal by pressing Ctrl+Alt+T on keyboard or searching from the overview screen. When it opens, run command:<\/p>\n<pre>sudo hostname NEW_NAME<\/pre>\n<p>Replace &#8216;NEW_NAME&#8217; in command with your desired computer name. And it will take place until reboot.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hostname-temp1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hostname-temp1.png\" alt=\"\" width=\"601\" height=\"228\" class=\"aligncenter size-full wp-image-34670\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hostname-temp1.png 601w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hostname-temp1-300x114.png 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/a><\/p>\n<p>NOTE: the new name takes effect immediately but not visible until you start a new terminal window.<\/p>\n<h3>Change computer name permanently:<\/h3>\n<p>In most Linux distributions, you can edit the &#8220;<b>\/etc\/hostname<\/b>&#8221; configuration file to set new computer name.<\/p>\n<p>1.) To do so, open terminal from start menu or connect to the command console of remote server, then run command:<\/p>\n<pre>sudo nano \/etc\/hostname<\/pre>\n<p>This command will edit the config file via <code>nano<\/code>, the universal command line text editor. You may replace it with your favorite text editor, such as <b>gedit<\/b> for GNOME desktop.<\/p>\n<p>When the file opens, delete the old name and type a new one. And press <b>Ctrl+X<\/b>, then type <b>y<\/b>, and hit Enter to save changes!<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/edit-computername.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/edit-computername.png\" alt=\"\" width=\"600\" height=\"428\" class=\"aligncenter size-full wp-image-34671\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/edit-computername.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/edit-computername-300x214.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>2.) It&#8217;s important to edit <b>\/etc\/hosts<\/b> file to map the new name to 127.0.1.1 and\/or the permanent IP address if any.<\/p>\n<pre>sudo nano \/etc\/hosts<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hosts-computername.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hosts-computername.png\" alt=\"\" width=\"600\" height=\"440\" class=\"aligncenter size-full wp-image-34672\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hosts-computername.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/10\/hosts-computername-300x220.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>NOTE: you have to set same name in both \/etc\/hosts and \/etc\/hostname to avoid networking issues. And save file by pressing Ctrl+X, type y, and hit Enter.<\/p>\n<p>Finally reboot to apply change and enjoy!<\/p>","protected":false},"excerpt":{"rendered":"<p>This simple tutorial shows you how to change the hostname (also known as computer name) in Ubuntu 21.10 Impish Idri. The computer name is a unique identifier given to each computer. It&#8217;s not a big deal for small home networks or single use home computers. It matters however in larger organizations where you need to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":34661,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[733,732],"class_list":["post-2014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-modify-ubuntu","tag-computer-name","tag-hostname"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/2014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=2014"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/2014\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/34661"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=2014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=2014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=2014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}