Linuxpidof命令如何使用

本篇內(nèi)容介紹了“Linux pidof命令如何使用”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!

站在用戶的角度思考問題,與客戶深入溝通,找到七臺河網(wǎng)站設(shè)計與七臺河網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都網(wǎng)站制作、成都網(wǎng)站設(shè)計、外貿(mào)營銷網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名注冊虛擬主機、企業(yè)郵箱。業(yè)務(wù)覆蓋七臺河地區(qū)。

一、什么是pidof命令?

復制代碼 代碼如下:

#man pidof中的解釋:
pidof — find the process id of a running program.
pidof–用于查找一個運行的程序的pid。
pidof is actually the same program as killall5;
[root@gogo ~]# ls -l /sbin/pidof
lrwxrwxrwx. 1 root root 8 aug 25 00:40 /sbin/pidof -> killall5 //的確如此。


二、pidof命令的參數(shù)
-s 表示只返回1個 pid
-x 表示同時返回運行給定程序的 shell 的 pid
-o 表示告訴 piod 表示忽略后面給定的 pid ,可以使用多個 -o 。
pidof is simply a (symbolic) link to the killall5 program, which should also be located in /sbin.
when pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. otherwise it
is possible that it returns pids of running programs that happen to have the same name as the program you're after but are
actually other programs.
如果 是一個 fullpath 則 pidof 不會出錯,但如果不是則有可能返回和給定同名的程序。

三、pidof命令使用實例

復制代碼 代碼如下:

[root@gogo ~]# pidof nginx
1476 1475 1473 1472 1471 1470 1469 1467 1466
[root@gogo ~]# ps -ef | grep nginx
nginx     1450  1449  0 20:16 ?        00:00:00 php-fpm: pool www
nginx     1451  1449  0 20:16 ?        00:00:00 php-fpm: pool www
nginx     1452  1449  0 20:16 ?        00:00:00 php-fpm: pool www
nginx     1453  1449  0 20:16 ?        00:00:00 php-fpm: pool www
nginx     1454  1449  0 20:16 ?        00:00:00 php-fpm: pool www
root      1466     1  0 20:16 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     1467  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1469  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1470  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1471  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1472  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1473  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1475  1466  0 20:16 ?        00:00:00 nginx: worker process
nginx     1476  1466  0 20:16 ?        00:00:00 nginx: worker process
root      2234  2141  0 20:24 pts/1    00:00:00 grep nginx
[root@gogo ~]# ps -ef | grep nginx | awk '{print $2}'
1450
1451
1452
1453
1454
1466
1467
1469
1470
1471
1472
1473
1475
1476
2237
[root@gogo ~]# pidof -s nginx
1476
[root@gogo ~]# pidof sshd
2139 1163
[root@gogo ~]# ps -ef | grep sshd
root      1163     1  0 20:16 ?        00:00:00 /usr/sbin/sshd
root      2139  1163  0 20:20 ?        00:00:00 sshd: root@pts/1

“Linux pidof命令如何使用”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

當前題目:Linuxpidof命令如何使用
標題路徑:http://muchs.cn/article18/ghicdp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、面包屑導航、響應(yīng)式網(wǎng)站、小程序開發(fā)、外貿(mào)網(wǎng)站建設(shè)、標簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站