CentOS7linux系统设置命令大全


linux系统一般是没有各种管家软件的,对于习惯了360全家桶或者腾讯全家桶的人可能有点不习惯,这里整理了一些linux系统设置命令,可以满足一下部分人的强迫症。

系统优化设置:

开机启动项:

 查看开机启动服务状态:systemctl list-unit-files

 查看所有开机启动项:systemctl list-unit-files | grep enable

 关闭所有开机启动项:for oldboy in `systemctl list-unit-files|grep enabled |awk '{print $1}'` ;do systemctl disable $oldboy ;done

 开启最小化服务:for oldboy in network-online.target network-pre.target network.target crond.service rsyslog.service sshd.service sysstat.service ;do systemctl enable $oldboy ;done

 查看开启的服务:systemctl list-unit-files|grep enabled   

防火墙设置:


 查看防火墙状态:systemctl status firewalld.service


 关闭:systemctl stop firewalld


 开启:systemctl start firewalld


 开机自动关闭:systemctl disable firewalld


 开机自动启动:systemctl enable firewalld

时间设置:

设置时区:ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


 timedatectl set-timezone "Asia/Shanghai"

 设置与网络时间同步:yum -y install ntp ntpdate


 ntpdate cn.pool.ntp.org

 将系统写入硬件时间: hwclock --systohc

 查看系统时间:timedatectl



猜你喜欢

转载自www.cnblogs.com/xwenbin/p/10627965.html