CentOS 7很多命令較CentOS 6有很大的改變,總結(jié)了部分自己可能會(huì)用到的,比如啟動(dòng),關(guān)閉,重啟,設(shè)置自啟動(dòng)等等。
這里以nginx為例:
| 任務(wù) | 舊指令 | 新指令 |
|---|---|---|
| 自動(dòng)啟動(dòng) | chkconfig nginx on | systemctl enable nginx.service |
| 不自動(dòng)啟動(dòng) | chkconfig nginx off | systemctl disable nginx.service |
| 檢查服務(wù)狀態(tài) | service httpd status | systemctl status nginx.service (服務(wù)詳細(xì)信息) |
| 檢查服務(wù)狀態(tài) | systemctl is-active nginx.service (是否 Active) | |
| 顯示所有服務(wù) | chkconfig --list | systemctl list-units --type=service |
| 啟動(dòng)服務(wù) | service nginx start | systemctl start nginx.service |
| 停止服務(wù) | service nginx stop | systemctl stop nginx.service |
| 重啟服務(wù) | service nginx restart | systemctl restart nginx.service |