{"id":18656,"date":"2022-09-17T05:23:39","date_gmt":"2022-09-17T05:23:39","guid":{"rendered":"https:\/\/linuxways.net\/?p=18656"},"modified":"2024-02-27T06:52:35","modified_gmt":"2024-02-27T06:52:35","slug":"change-hostname-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/change-hostname-ubuntu-22-04\/","title":{"rendered":"How to Change the Hostname in Ubuntu 22.04"},"content":{"rendered":"<p>A <strong>hostname <\/strong>is an identifier in human readable format that identifies a device on a network. Ubuntu lets you set the <strong>hostname<\/strong> during its installation, as well as allows you to change the <strong>hostname <\/strong>later on using several methods. Changing the <strong>hostname<\/strong> adds several advantages to the users, such as it will remove confusion or conflicts between multiple devices having the same <strong>hostname<\/strong> on the network. Further, there are some organizations that might force you to change the <strong>hostname<\/strong> to maintain consistency across their network structure or reflect their brand names.<\/p>\n<p><strong>Outline:<\/strong><\/p>\n<ul>\n<li><a href=\"#post-25312-_acj9ostzykng\">How to Change Hostname on Ubuntu 22.04<\/a><\/li>\n<li><a href=\"#post-25312-_ii89fyt8fva\">Conclusion<\/a><\/li>\n<\/ul>\n<h2><a id=\"post-25312-_acj9ostzykng\"><\/a>How to Change Hostname on Ubuntu 22.04<\/h2>\n<p>The <strong>hostname <\/strong>on Ubuntu can be changed through:<\/p>\n<ul>\n<li><a href=\"#post-25312-_d6al8hmztx72\">Terminal<\/a><\/li>\n<li><a href=\"#post-25312-_ip3dzx9y1v88\">GUI<\/a><\/li>\n<\/ul>\n<h2><a id=\"post-25312-_d6al8hmztx72\"><\/a>How to Change Hostname on Ubuntu 22.04 Using Terminal<\/h2>\n<p>Here is the list of methods to change the<strong> hostname <\/strong>through Terminal using:<\/p>\n<ul>\n<li><a href=\"#post-25312-_ljhnvjqjabio\">hostname Command (Temporary)<\/a><\/li>\n<li><a href=\"#post-25312-_dhtehe46ukyk\">hostnamectl Command (Permanent)<\/a><\/li>\n<li><a href=\"#post-25312-_ow4vborl75vk\">Hostname and Hosts File (Reboot Required)<\/a><\/li>\n<li><a href=\"#post-25312-_2n42717pic9p\">sysctl Command<\/a><\/li>\n<li><a href=\"#post-25312-_e3bpz78rpiq1\">nmcli Command<\/a><\/li>\n<li><a href=\"#post-25312-_rws1m7jh52s1\">nmtui Command<\/a><\/li>\n<\/ul>\n<h3><a id=\"post-25312-_ljhnvjqjabio\"><\/a>Method 1: Change Hostname on Ubuntu 22.04 Using hostname Command (Temporary)<\/h3>\n<p>The <strong>hostname<\/strong> command serves the purpose of displaying the system <strong>hostname<\/strong> on Ubuntu. It can also change the <strong>hostname<\/strong> with sudo privileges followed by the<strong> hostname <\/strong>provided by the user. But, it only changes the <strong>hostname<\/strong> for the current Ubuntu session. Whenever the session expires or closes, the <strong>hostname<\/strong> will revert to the previous one.<\/p>\n<p>Check the guided instructions given below to change the <strong>hostname <\/strong>of your Ubuntu system.<\/p>\n<h3><a id=\"post-25312-_izc97eywbkhm\"><\/a>Step 1: Check the Hostname<\/h3>\n<p>Before changing the <strong>hostname<\/strong>, let&#8217;s check the existing <strong>hostname<\/strong> of the system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25320\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-1.png\" \/><\/p>\n<h3><a id=\"post-25312-_8maq0xolteqo\"><\/a>Step 2: Change the Hostname on Ubuntu<\/h3>\n<p>As we know the <strong>hostname<\/strong> cannot be changed without the permission of the sudo user. So, to change the <strong>hostname<\/strong>, first, add the sudo command to get sudo permission, and then use the <strong>hostname<\/strong> command and specify the desired <strong>hostname<\/strong>:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">hostname<\/span> alex<\/div><\/div>\n<p>Type the user password to authenticate the process:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25322\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-2.png\" \/><\/p>\n<h3><a id=\"post-25312-_ey7akw7dgssp\"><\/a>Step 3: Apply the Change<\/h3>\n<p>After changing the <strong>hostname<\/strong>, it is a must to apply the change, it can be done from the below-given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">newgrp<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25325\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-3.png\" \/><\/p>\n<h3><a id=\"post-25312-_33ekn0xfo7qc\"><\/a>Step 4: Verify the Change<\/h3>\n<p>Once the changes are applied, execute the <strong>hostname <\/strong>command again to verify whether the hostname was changed on Ubuntu or not:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25329\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-4.png\" \/><\/p>\n<h3><a id=\"post-25312-_dhtehe46ukyk\"><\/a>Method 2: Change Hostname on Ubuntu 22.04 Using hostnamectl Command Without Reboot (Permanent)<\/h3>\n<p>Just like the <strong>hostname<\/strong> command, the <strong>hostnamectl<\/strong> command also displays the <strong>hostname <\/strong>but with complete system details. Changing <strong>hostname<\/strong> requires administrator permissions. Unlike the<strong> hostname <\/strong>command, the <strong>hostnamectl <\/strong>command changes the <strong>hostname<\/strong> of the Ubuntu system permanently. Additionally, you do not have to restart the system to apply the changes. Follow the steps given below to change the <strong>hostname<\/strong> through <strong>hostnamectl<\/strong> command:<\/p>\n<h3><a id=\"post-25312-_a11kd1lkkqy\"><\/a>Step 1: Change Hostname<\/h3>\n<p>First, use the <strong>sudo<\/strong> command to allow the administrator privileges followed by the <strong>hostnamectl<\/strong> command, and use the <strong>set-hostname<\/strong> command to specify the new <strong>hostname <\/strong>of your choice:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> hostnamectl set-hostname james<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25333\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-5.png\" \/><\/p>\n<h3><a id=\"post-25312-_t5hlcsco70ti\"><\/a>Step 2: Apply the Hostname Change<\/h3>\n<p>Once the <strong>hostname<\/strong> is changed, execute the <strong>newgrp<\/strong> command to apply the change:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">newgrp<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25338\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-6.png\" \/><\/p>\n<h3><a id=\"post-25312-_m5dbka4r8ns\"><\/a>Step 3: Verify the Hostname Change<\/h3>\n<p>Once the <strong>hostname<\/strong> is changed, execute the given command to verify the <strong>hostname<\/strong> change:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">hostnamectl<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25344\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-7.png\" \/><\/p>\n<h3><a id=\"post-25312-_ow4vborl75vk\"><\/a>Method 3: Change the Hostname on Ubuntu 22.04 Using the hostname and hosts File (Reboot Required)<\/h3>\n<p>Your system <strong>hostname <\/strong>is stored in the <strong>hostname<\/strong> and <strong>hosts<\/strong> file located within the <strong>etc<\/strong> directory. So you can change the <strong>hostname<\/strong> of the Ubuntu system by editing these files by following the instructions given below.<\/p>\n<h3><a id=\"post-25312-_c866glav8bxu\"><\/a>Step 1: Edit Hostname File<\/h3>\n<p>Open the <strong>hostname<\/strong> file located in the <strong>etc<\/strong> directory and edit with the <strong>nano<\/strong> editor by executing this command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p>Replace the existing <strong>hostname <\/strong>of your Ubuntu machine with the new one of your choice:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25354\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-8.png\" \/><\/p>\n<p>Press <strong>CTRL + O<\/strong> and hit <strong>Enter<\/strong> to save the changes. Lastly, <strong>CTRL + X<\/strong> to exit the editor.<\/p>\n<p>Or, you can edit the <strong>hosts<\/strong> file just like the <strong>hostname<\/strong> file by executing this command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>hosts<\/div><\/div>\n<p>Locate the existing <strong>hostname<\/strong> in front of the <strong>IP address<\/strong> and replace it with the new one of your choice:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25360\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-9.png\" \/><\/p>\n<p>Save the <strong>hostname<\/strong> changes and exit.<\/p>\n<h3><a id=\"post-25312-_n8h9phodrw9x\"><\/a>Step 2: Restart the System<\/h3>\n<p>Now, reboot the system, so changes can take effect by executing the below command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> reboot<\/div><\/div>\n<h3><a id=\"post-25312-_oicqt9ttk5mi\"><\/a>Step 3: Verify the Hostname Change<\/h3>\n<p>To check whether the <strong>hostname <\/strong>was changed or not, you can run the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25369\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-10.png\" \/><\/p>\n<h3><a id=\"post-25312-_2n42717pic9p\"><\/a>Method 4: Change Hostname on Ubuntu 22.04 Using sysctl Command<\/h3>\n<p>The <strong>sysctl<\/strong> command lets administrators modify, read, and write the changes to the Ubuntu system. Besides that, it can change the hostname on Ubuntu 22.04. You can change the<strong> hostname <\/strong>on Ubuntu 22.04 using the <strong>sysctl <\/strong>command by following the step-by-step instructions below.<\/p>\n<p><strong>Step 1: Change the Hostname on Ubuntu<\/strong><\/p>\n<p>To change the <strong>hostname<\/strong>, first, use the <strong>sudo<\/strong> command to get the admin privileges. Then, use the <strong>sysctl<\/strong> command, along with the <strong>kernel.hostname<\/strong> object keyword and then specify the new<strong> hostname<\/strong> after the <strong>=<\/strong> sign:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> sysctl kernel.hostname=linuxways<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25378\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-11.png\" \/><\/p>\n<p><strong>Step 2: Apply the Hostname Change<\/strong><\/p>\n<p>To apply and save the changes to the <strong>hostname,<\/strong> execute the <strong>newgrp<\/strong> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">newgrp<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25388\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-12.png\" \/><\/p>\n<p><strong>Step 3: Verify the Hostname Change<\/strong><\/p>\n<p>Check the <strong>hostname<\/strong>, whether it was changed or not by executing the <strong>hostname<\/strong> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25399\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-13.png\" \/><\/p>\n<h3><a id=\"post-25312-_e3bpz78rpiq1\"><\/a>Method 5: Change Hostname on Ubuntu 22.04 Using nmcli Command<\/h3>\n<p>The <strong>nmcli<\/strong> command is used to manage the network connections. The <strong>nmcli <\/strong>command can also change the <strong>hostname <\/strong>on Ubuntu 22.04. Check the instructions provided below to change the <strong>hostname<\/strong> using the <strong>nmcli <\/strong>command.<\/p>\n<h3><a id=\"post-25312-_d9k8shsc5mmw\"><\/a>Step 1: Change the Hostname on Ubuntu<\/h3>\n<p>To change the <strong>hostname <\/strong>using the <strong>nmcli<\/strong> command, first, add the sudo command to get the admin privileges. Then, use the <strong>nmcli<\/strong> to change the <strong>hostname<\/strong>, alongside the <strong>general<\/strong> and <strong>hostname<\/strong> keywords followed by the new <strong>hostname<\/strong> of your choice:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> nmcli general <span class=\"kw2\">hostname<\/span> farhan<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25406\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-14.png\" \/><\/p>\n<h3><a id=\"post-25312-_cj9ikjamni9a\"><\/a>Step 2: Apply the Change to the Hostname<\/h3>\n<p>Once you changed the <strong>hostname<\/strong>, it is necessary to apply the changes to the system <strong>hostname<\/strong> by executing the <strong>newgrp<\/strong> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">newgrp<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25413\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-15.png\" \/><\/p>\n<h3><a id=\"post-25312-_6744infu03wy\"><\/a>Step 3: Verify the Change<\/h3>\n<p>Check the <strong>hostname<\/strong> to verify whether it was changed or not by executing the <strong>hostname<\/strong> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25419\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-16.png\" \/><\/p>\n<h3><a id=\"post-25312-_rws1m7jh52s1\"><\/a>Method 6: Change Hostname on Ubuntu 22.04 Using nmtui Command<\/h3>\n<p>The <strong>nmtui<\/strong> command allows the users to edit, create, or activate a connection. Furthermore, it lets you set the <strong>hostname<\/strong> of the system. Check the instructions below to change the <strong>hostname<\/strong> through the <strong>nmtui <\/strong>command.<\/p>\n<h3><a id=\"post-25312-_vthy06y83h7s\"><\/a>Step 1: Open the NetworkManager (TUI) Window<\/h3>\n<p>Open Terminal and run the <strong>nmtui<\/strong> command to open the <strong>NetworkManager (TUI)<\/strong> interface:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">nmtui<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25426\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-17.png\" \/><\/p>\n<h3><a id=\"post-25312-_bc8a3v90rpe3\"><\/a>Step 2: Edit the Hostname<\/h3>\n<p>Once the <strong>NetworkManager TUI<\/strong> interface is launched, select the <strong>Set system hostname<\/strong> option and click the <strong>OK<\/strong> button:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25431\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-18.png\" \/><\/p>\n<p>Remove the existing<strong> hostname <\/strong>first, then, write the new <strong>hostname <\/strong>and hit the <strong>OK<\/strong> button:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25433\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-19.png\" \/><\/p>\n<p>Enter the password to authenticate the Ubuntu system to change the <strong>hostname<\/strong>.<\/p>\n<p>Press the <strong>OK<\/strong> button to finish the editing of the <strong>hostname<\/strong>:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25438\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-20.png\" \/><\/p>\n<p>Now, hit the <strong>Quit<\/strong> button to close the <strong>NetworkManager (TUI)<\/strong> interface:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25441\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-21.png\" \/><\/p>\n<h3><a id=\"post-25312-_qca3k76nscx4\"><\/a>Step 3: Apply the Hostname Change<\/h3>\n<p>After changing the <strong>hostname<\/strong>, type and execute the <strong>newgrp<\/strong> command to save and apply the new <strong>hostname<\/strong>:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">newgrp<\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25445\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-22.png\" \/><\/p>\n<h3><a id=\"post-25312-_jvnaezihmyok\"><\/a>Step 4: Verify the Hostname Change<\/h3>\n<p>Check whether the <strong>hostname <\/strong>changed or not by executing the <strong>hostname<\/strong> command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25450\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-23.png\" \/><\/p>\n<h2><a id=\"post-25312-_ip3dzx9y1v88\"><\/a>How to Change Hostname on Ubuntu 22.04 Using GUI (Graphical User Interface)<\/h2>\n<p>Alongside the terminal, users can also change the <strong>hostname <\/strong>using GUI. Changing the <strong>hostname<\/strong> using GUI is comparatively easy, and anyone with a basic understanding can do it.<\/p>\n<h3><a id=\"post-25312-_pacttiy0ubkx\"><\/a>Step 1: Open System Settings<\/h3>\n<p>Click on the top right corner and select <strong>Settings<\/strong> to launch:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25464\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-24.png\" \/><\/p>\n<h3><a id=\"post-25312-_f59ws1cf3h5d\"><\/a>Step 2: Open the About Settings<\/h3>\n<p>Once the <strong>Settings<\/strong> is launched, look for the <strong>About<\/strong> tab and click on this section:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25474\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-25.png\" \/><\/p>\n<h3><a id=\"post-25312-_hiuos8jdmy2i\"><\/a>Step 3: Change the Hostname on Ubuntu<\/h3>\n<p>Look for the <strong>Device Name<\/strong> section and click on it to edit the hostname:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25485\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-26.png\" \/><\/p>\n<p>Remove the existing<strong> hostname<\/strong>, type the new <strong>hostname,<\/strong> and hit the <strong>Rename<\/strong> button to change the hostname:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25491\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-27.png\" \/><\/p>\n<p>You can also change the hostname on Ubuntu 22.04 using the <strong>Sharing<\/strong> option in GUI. For that, navigate to <strong>Settings&gt;Sharing<\/strong>, replace the existing <strong>hostname<\/strong> with your desired<strong> hostname<\/strong>, and press <strong>Enter<\/strong>:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-25494\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-28.png\" \/><\/p>\n<p>Verify the <strong>hostname<\/strong> change on Ubuntu using the <strong>hostname<\/strong> command in Terminal:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">hostname<\/span><\/div><\/div>\n<p><img decoding=\"async\" class=\"wp-image-25496\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/02\/word-image-25312-29.png\" \/><\/p>\n<h2><a id=\"post-25312-_ii89fyt8fva\"><\/a>Conclusion<\/h2>\n<p>Changing the <strong>hostname<\/strong> of the device will allow you to differentiate between the devices on the same network. The <strong>hostname<\/strong> on Ubuntu can be changed using both Terminal and GUI. For Terminal, you can use the <strong>hostname<\/strong>, <strong>hostnamectl<\/strong>,<strong> sysctl,<\/strong> <strong>nmtui,<\/strong> and <strong>nmcli <\/strong>commands to change the <strong>hostname<\/strong>. Furthermore, you can also change the <strong>hostname <\/strong>by editing the <strong>hostname <\/strong>and <strong>hosts <\/strong>file. To change the <strong>hostname<\/strong> using GUI, open <strong>Settings<\/strong>, and navigate to the <strong>About <\/strong>section, click the <strong>Device Name<\/strong> section, rename the <strong>hostname<\/strong> to your desired one. Or, you can go to <strong>Settings&gt;Sharing<\/strong> and change the <strong>hostname<\/strong> there.<\/p>\n<p>In short, each method lets you change the hostname on Ubuntu, but my recommendation is to change it using the <strong>hostnamectl <\/strong>command because it changes the <strong>hostname <\/strong>permanently without rebooting the system.<\/p>","protected":false},"excerpt":{"rendered":"<p>Practical tutorial on how to change the hostname in Ubuntu 22.04 LTS Jammy Jellyfish Linux distribution using two different methods &#8211; the terminal and the GUI.<\/p>","protected":false},"author":110,"featured_media":18692,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-18656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/18656","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\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=18656"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/18656\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/18692"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=18656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=18656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=18656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}