天天看点

CentOS7系统常用命令

查看所有网卡IP地址——ip addr

启动防火墙——systemctl start firewalld.service

停止防火墙——systemctl stop firewalld.service

禁止防火墙开机启动——systemctl disable firewalld.service

列出正在运行的服务状态——systemctl

启动一个服务——<code>systemctl start postfix.service</code>

<code>关闭一个服务——<code>systemctl stop postfix.service</code></code>

<code>重启一个服务:——<code>systemctl restart postfix.service</code></code>

<code>显示一个服务的状态——<code>systemctl status postfix.service</code></code>

<code>在开机时启用一个服务——<code>systemctl enable postfix.service</code></code>

<code>在开机时禁用一个服务——<code>systemctl disable postfix.service</code></code>

<code>查看服务是否开机启动——<code>systemctl is-enabled postfix.service;echo $?</code></code>

<code>查看已启动的服务列表——<code>systemctl list-unit-files|grep enabled</code></code>

<code><code>设置系统默认启动运行级别3——<code>ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target</code></code></code>

<code><code><code>设置系统默认启动运行级别5——<code>ln -sf/lib/systemd/system/graphical.target/etc/systemd/system/default.target</code></code></code></code>

<code><code><code><code> </code></code></code></code>

<code><code><code><code>本文转自 tianya1993 51CTO博客,原文链接:http://blog.51cto.com/dreamlinux/1744425,如需转载请自行联系原作者 </code></code></code></code>

继续阅读