Just installed a Ubuntu operating system under VMware, opened the terminal and found that the host name of this long ah, the entire window is fully occupied.
To modify the hostname using hostname, run the command: "hostname new host name"
#hostname TEST-VM
This modification is only temporary, and the completion of the modification requires that the terminal window be reopened before changing.
And after the modification, the execution of the command will require a long time to wait, and the prompt cannot resolve the host
The Hosts file needs to be modified to modify the host name to native IP mappings.
To permanently modify the hostname you need to modify the file/etc/hostname
sudo vi/etc/hostname
The difference between/etc/hostname and/etc/hosts
/etc/hostname is a host name, an example of a hostname file:
Test-vm
/etc/hosts storage is the domain name and IP correspondence, the domain name and hostname do not have any relationship,
You can specify any one name for any IP, an example of a hostname file:
127.0.0.1 localhost
127.0.1.1 TEST-VM
after the modification is complete, use the service services to make hostname effective
sudo/etc/init.d/hostname.sh start
=========== Document Information ============
Copyright Disclaimer: Non-commercial free reprint-retain Attribution-Annotated source
Attribution (by): TESTCS_DN (micro-wx laughter)
article source: [Ignorant life, record bit] (HTTP://BLOG.CSDN.NET/TESTCS_DN)
How to permanently modify the hostname host name without rebooting under Ubuntu system