How to change the host name of Linux computer

On a Linux computer, you can change the host name anytime you like following the method given below after opening a terminal window.

$ sudo vi /etc/hosts <enter>

127.0.0.1 mycomputer.mydomain.com <enter>
:wq

$ sudo vi /etc/hostname <enter>
Insert
mycomputer.mydomain.com <enter>
:wq

$ sudo hostname -F /etc/hostname <enter>

Now check if hostname has changed
$ hostname <enter>
Should return mycomputer.mydomain.com

Leave a Reply

  

  

  

Blue Captcha Image
Refresh

*

October 2019
M T W T F S S
« Sep    
 123456
78910111213
14151617181920
21222324252627
28293031