直接上案例: 例子:獲取nginx進程 方法:$ps -aux |grep nginx |grep -v grep |awk '{print $2}' 或者 $ps -ef |grep nginx |grep -v grep |awk '{print $2}' 例子:獲取gerrit ...
直接上案例: 例子:獲取nginx進程 方法:$ps -aux |grep nginx |grep -v grep |awk '{print $2}' 或者 $ps -ef |grep nginx |grep -v grep |awk '{print $2}' 例子:獲取gerrit ...
注意這條命令用反引號(Tab上面的那個鍵)括起來,作用類似於${ } processId = ` ps -ef | grep fms.jar | grep -v grep | awk '{print $2}' ` ps -ef | grep fms.jar 打印 ...
假設獲取tomcat內容相關的進程信息 命令:ps -ef | grep tomcat 這個腳本首先用ps -ef | grep tomcat 獲得了tomcat進程信息中,這樣出來的結果中會包含grep本身,因此通過 | grep -v grep 來排除grep本身,然后通過 awk ...
的那個 注:進程號越大,並不一定意味着進程的啟動時間越晚 查看指定名稱的進程信息默認只顯示PID ...
...
過濾器: ...
當我們查看某個服務的進程時候,它會把命令本身的進程顯示出來。如下圖: 進程號2383 就是我命令本身的進程號,和我實際想看的進程無關 特別是在我們寫腳本,kill進程時候會報錯: 解決辦法可以優化腳本 ps -ef|grep nginx |grep -v "grep ...
示例 etime ELAPSED elapsed time since the process was started, in the form [[dd-]hh:]mm:ss. 進程運行的總時間 例如 4-21:45:32 的意思是進程運行了4天 ...