1. Set host name modify the hostname by editing the hostname field in the/etc/sysconfig/network file. : [[email protected]/]# vim/etc/sysconfig/network as shown below networking=yes networking_ipv6=yes Hostname=zijuan Hostname=zijuan indicates that the host is set to zijuan. Note: After you modify the hostname, it takes effect after you restart the system. 2, view host name [[email protected]/]# hostname zijuan tip: Two simple commands temporarily set a hostname. (1) Use the SYSCTL command to modify kernel parameters, format: SYSCTL kernel.hostname= hostname, as follows. [[email protected]/]# sysctl kernel.hostname=newname KERNEL.HOSTNAME=NEWNAME   &NBsp; #newname为新设置的主机名 (2) Use the hostname command to set the host name. The format is: hostname host name, as follows. [[email protected]/]# hostname newname This setting is temporarily in effect. Setup fails after restarting the system.
Use of the hostname command:
Hostname-s,--short Short host name-a,--alias alias Names-i,--ip-address Addresses for the host name-f,--fqdn,--long long host name (FQDN)-D,--domain DNS domain n Ame-y,--YP,--nis nis/yp domain name-f,--file read host name or NIS domain name from GI Ven file
Linux view and set host name