Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright.
Deep Blue Blog:http://blog.csdn.net/huangyanlong/article/details/45476569
Mode one: Temporarily modify the host name
Grammar:
#hostname < host name >
Cases:
[Email protected]/]# hostname hyltest[[email protected]/]# su-last Login:sun May
Mode two: command to modify host name
Grammar:
#hostnamectl Set-hostname < host name >
View Hostnamectl Command Help
[Email protected] ~]# Hostnamectl-help
Hostnamectl [OPTIONS ...] COMMAND ...
Query or change system hostname.
-H--help Show This help
--version Show Package version
--transient only set transient hostname
--static only set static hostname
-- pretty only set pretty hostname
-P-- privileged acquire privileges before execution
--no-ask-password do and prompt for password
-h--host=[[email protected]]host Operate on remote host
Commands:
Status Show current hostname settings
Set-hostname NAME Set System hostname
Set-icon-name name Set icon name for host
Set-chassis NAME Set chassis type for host
Cases:
[Email protected] ~]# hostnamectl set-hostname hyldb[[email protected] ~]# su-last Login:sun May
Mode three: Configuration file manually modify the host name
Grammar:
Modifying the hostname configuration file
Cases:
[[email protected] ~]# Cd/etc[[email protected] etc]# VI hostnamehyldb~[[email protected] etc]# su-last Login:sun May
Summary:
Hostnamectl-help
/etc/hostname
Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright.
Deep Blue Blog:http://blog.csdn.net/huangyanlong/article/details/45476569
LINUX_CENTOS7 Configuring host Names