一、修改主机名
[root@localhost ~]# cat /etc/hostname
localhost.localdomain
[root@localhost ~]# hostnamectl set-hostname server28.example.com
[root@localhost ~]# cat /etc/hostname
server28.example.com
注:在centos7中主机名的信息存储在/etc/hostname中,而再也不是/etc/sysconfig/networkcentos
二、启动/关闭/重启/查看服务(systemctl start/stop/restart/status services)
[root@localhost ~]# systemctl start firewalld 启动防火墙
[root@localhost ~]# systemctl stop firewalld 关闭防火墙
[root@localhost ~]# systemctl restart firewalld 重启防火墙
[root@localhost ~]# systemctl status firewalld 查看防火墙状态
[root@localhost ~]# systemctl list-unit-files 查看系统全部服务的状态
三、设置服务的自启动
[root@localhost ~]# systemctl enable sshd 设置sshd开机自动
[root@localhost ~]# systemctl disable sshd 设置sshd不开机自启dom
四、进入紧急/图形/单用户/拯救模式
[root@localhost ~]# systemctl isolate
emergency.targer graphical.target multi-user.target rescue.targetssh
五、关机/重启
[root@localhost ~]# systemctl halt 关机
[root@localhost ~]# systemctl reboot 重启ide