linux筆記之systemctl命令

2021-09-25 13:14:48 字數 939 閱讀 2702

通過systemctl來管理單一服務的啟動、開機啟動和狀態檢視。

systemctl [command] [unit]

command主要有:

start:立刻啟動unit

stop:立刻關閉unit

restart:立即重啟

enable:開機啟動

disable:開機不啟動

is-active:當前有沒有在執行

is-enable:開機時是否預設啟動unit

特別注意:當某項服務存在依賴時,僅僅關閉一項服務而沒有關閉其他的服務的話是沒用的,因為當其依賴的其他服務使用時,會喚醒該服務。

可以使用(mask)強迫服務登出,該命令會將某服務的依賴服務一併關閉:

如下:systemctl mask 【服務】 //使用unmask用來取消登出操作

使用systemctl  檢視系統的所有服務

systemctl [command] [unit]

command:

list-units :顯示目前啟動的unit

list-unit-files:由/usr/lib/systemd/system/內的檔案,將所有的檔案列表說明

通過systemctl來管理不同的操作環境

systemctl [command] [unit.target]

command:

get-default:取得目前的target

set-default:設定後面的unit.target為預設操作模式

isolate:切換模式

例如:systemctl isolate graphical.target 切換到圖形介面

systemctl isolate multi-user.target 切換到純命令模式

linux命令之筆記

linux 之筆記大雜會 後續會更新 centos 網路 mycat shading jdbc atlos mysql proxyfreenasyum install net tools磁碟相關 raidi 0 1 esxi raid5 2 4 vm raid6 5 11 電腦之配置 1.cpu 2...

Linux學習筆記之 管道

8 管道 8.1 無名管道 無名管道通常直接稱之為管道,它占用兩個檔案描述符,不能被非血緣關係 的程序共享,一般應用在父子程序中 8.2 無名管道的建立 include int pipe int fildes 2 函式pipe在核心中建立乙個管道,並分配兩個檔案描述符標識管道的兩端,這兩個檔案描述符...

linux命令筆記之dd

例項 建立乙個100m的空檔案 dd if dev zero of hello.txt bs 100m count 1 首先要了解兩個特殊的裝置 dev null 站 無底洞 dev zero 產生字元 測試磁碟寫能力 time dd if dev zero of test.dbf bs 8k co...