grep命令 是查找, 是一種強大的文本搜索工具,它能 使用正則表達式 搜索文本,并把匹 配的行打印出來。 grep全稱是Global Regular Expression Print,表示全局正則表達式版本,它的使用權(quán)限是所有用戶。 ps的意思是process status,即進程狀態(tài)。在控制臺執(zhí)行man ps 命令可以查看ps命令后面的命令選項的含義如下 -A Display information about other users' processes, including those without controlling terminals
-e Identical to -A. -f Display the uid, pid, parent pid, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and the associated command. If the -u option is also used, display the user name rather then the numeric uid. When -o or -O is used to add to the display follow-
ing -f, the command field is not truncated as severely as it is in other formats.
更多的ps命令可以通過 man ps 或者 ps --help all 來獲取 Linux下顯示系統(tǒng)進程的命令ps,最常用的有ps -ef 和ps aux。這兩個到底有什么區(qū)別呢?兩者沒太大差別,討論這個問題,要追溯到Unix系統(tǒng)中的兩種風(fēng)格,System V風(fēng)格和BSD 風(fēng)格,ps aux最初用到Unix Style中,而ps -ef被用在System V Style中,兩者輸出略有不同?,F(xiàn)在的大部分Linux系統(tǒng)都是可以同時使用這兩種方式的。 UID :程序被該 UID 所擁有 PID :就是這個程序的 ID PPID :則是其上級父程序的ID C :CPU使用的資源百分比 STIME :系統(tǒng)啟動時間 TTY :登入者的終端機位置 TIME :使用掉的CPU時間。 CMD :所下達的是什么指令
同ps -ef 不同的有列有 USER //用戶名 %CPU //進程占用的CPU百分比 %MEM //占用內(nèi)存的百分比 VSZ //該進程使用的虛擬內(nèi)存量(KB) RSS //該進程占用的固定內(nèi)存量(KB)(駐留中頁的數(shù)量) STAT //進程的狀態(tài) START //該進程被觸發(fā)啟動時間 TIME //該進程實際使用CPU運行的時間 其中STAT狀態(tài)位常見的狀態(tài)字符有 D //無法中斷的休眠狀態(tài)(通常 IO 的進程); R //正在運行可中在隊列中可過行的; S //處于休眠狀態(tài); T //停止或被追蹤; W //進入內(nèi)存交換 (從內(nèi)核2.6開始無效); X //死掉的進程 (基本很少見); Z //僵尸進程; < //優(yōu)先級高的進程 N //優(yōu)先級較低的進程 L //有些頁被鎖進內(nèi)存; s //進程的領(lǐng)導(dǎo)者(在它之下有子進程); l //多線程,克隆線程(使用 CLONE_THREAD, 類似 NPTL pthreads); + //位于后臺的進程組; systemctl status mysql systemctl is-enabled 命令:service nginx status 
查看某個服務(wù)的狀態(tài) 作者:Gakki0725 鏈接:https://www.jianshu.com/p/907286f53972 來源:簡書
systemctl list-unit-files --type=service
|