linux centos7 常用命令【systemctl替換service】__linux

來源:互聯網
上載者:User

雖然linux的命令很多都是相同的,但是新版的centos 7 上面與以前的有些命令還是有所不同,不過還好,有提示。所以就在百度上面搜尋了以下,作為記載,以後方便查看:

centos7 上面啟動服務以及關閉服務已經不是以前的service stop/start xxxx了而是systemctl命令,不過用service他會有一個提醒你用systemctl,所以大可不必擔心。

看所有網卡IP地址——ip addr

 

啟動防火牆——systemctl start firewalld.service

 

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


查看firewalld防火牆狀態——firewall-cmd --state

 

禁止防火牆開機啟動——systemctl disable firewalld.service

 

列出正在啟動並執行服務狀態——systemctl

 

啟動一個服務——systemctl start postfix.service

 

關閉一個服務——systemctl stop postfix.service

 

重啟一個服務:——systemctl restart postfix.service

 

顯示一個服務的狀態——systemctl status postfix.service

 

在開機時啟用一個服務——systemctl enable postfix.service

 

在開機時禁用一個服務——systemctl disable postfix.service

 

查看服務是否開機啟動——systemctl is-enabled postfix.service;echo $?

 

查看已啟動的服務列表——systemctl list-unit-files|grep enabled

 

設定系統預設啟動運行層級3——ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

 

設定系統預設啟動運行層級5——ln -sf/lib/systemd/system/graphical.target/etc/systemd/system/default.target


原文地址:http://www.centoscn.com/CentOS/help/2015/0618/5687.html




相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.