ps ef grep 輸出的具體含義

2022-08-18 00:15:10 字數 1122 閱讀 1411

ps -ef 命令就是列出當前所有的程序資訊

grep 起到乙個過濾的檔案

[root@localhost ~]# ps -ef | grep apachejetspeed

root     18887 18828  0 08:09 pts/0    00:00:00 grep apachejetspeed

字段含義如下:

uid       pid   ppid     c stime   tty    time     cmd

root     18887 18828   0  08:09     pts/0    00:00:00    grep apachejetspeed

ps:將某個程序顯示出來

-a  顯示所有程式。 

-e  此引數的效果和指定"a"引數相同。

-f  顯示uid,ppip,c與stime欄位。 

grep命令是查詢

中間的|是管道命令 是指ps命令與grep同時執行

這條命令的意思是顯示有關apachejetspeed有關的程序

uid pid ppid c stime tty time cmd

uid 程式被該 uid 所擁有

pid 就是這個程式的 id 

ppid 則是其上級父程式的id

c cpu 使用的資源百分比

stime 系統啟動時間

tty 登入者的終端機位置

time 使用掉的 cpu 時間。

cmd 所下達的指令為何

對於查詢結果,如何判斷是執行與否呢?

這是因為ps -ef是顯示所有程序的訊息,包括apachejetspeed和grep apachejetspeed這兩個甚至包括ps -ef本身,而grep是查詢輸出包含想要的字串的行,也就是說grep apachejetspeed是在所有執行的程序中查詢輸出包含「apachejetspeed」字串的輸出行,這裡面就包含apachejetspeed,和grep apachejetspeed 兩個程序。

即,如果執行了會顯示兩條輸出一條是apachejetspeed的,令一條是grep apachejetspeed的。

如果沒執行只會顯示grep apachejetspeed的。

ps ef grep 輸出的具體含義

比如 root localhost ps ef grep apachejetspeed root 18887 18828 0 08 09 pts 0 00 00 00 grep apachejetspeed 字段含義如下 uid pid ppid c stime tty time cmd root ...

ps ef grep 輸出的具體含義

經常使用linux的朋友,經常可能會使用ps ef grep 服務名來對於查詢服務是否正常執行,通常情況下我們知道,如果只是蹦出一條資訊,如下面所示,這是因為ps ef是顯示所有程序的訊息,包括vncserver 1.service和grep vncserver 1.service這兩個甚至包括ps...

ps ef grep 輸出的具體含義

比如 root localhost ps ef grep apachejetspeed root 18887 18828 0 08 09 pts 0 00 00 00 grep apachejetspeed 字段含義如下 uid pid ppid c stime tty time cmd root ...