問題背景
按照我之前,在腳本中,獲取除腳本自身進(jìn)程之外與腳本同名進(jìn)程號(hào)的方法:
ps -ef | grep "${SCRIPT_NAME}" | grep -v "grep" | awk '{print $2}' | grep -v "$PID"
這種方法有很大問題,莫名奇妙的,它無法正常過濾掉grep的進(jìn)程(這里面還有點(diǎn)復(fù)雜,我一時(shí)半會(huì)也搞不明白咋回事,據(jù)說是grep會(huì)開子進(jìn)程,并非grep那個(gè)子進(jìn)程,而是開了一個(gè)與腳本相同的進(jìn)程,導(dǎo)致出現(xiàn)問題,具體參考:linux shell腳本執(zhí)行命令時(shí)創(chuàng)建子進(jìn)程問題(特定的情況,例如后臺(tái)運(yùn)行、管道、分支或子shell等,腳本可能會(huì)創(chuàng)建子進(jìn)程執(zhí)行命令)grep)
后來我改用pgrep指令,用這個(gè)命令的好處是,不用使用grep命令了,它直接找出來就是進(jìn)程號(hào),而且不會(huì)帶入額外的進(jìn)程號(hào),下面我們來看下pgrep指令的具體用法。
pgrep指令
pgrep命令用于根據(jù)進(jìn)程的名稱或其他屬性來查找和列出匹配的進(jìn)程ID(PID)。它可以根據(jù)不同的選項(xiàng)進(jìn)行靈活的進(jìn)程查找和過濾。
help文檔
root@ubuntu:/ky/boot# pgrep --help
Usage:
pgrep [options] <pattern>
Options:
-d, --delimiter <string> specify output delimiter
-l, --list-name list PID and process name
-a, --list-full list PID and full command line
-v, --inverse negates the matching
-w, --lightweight list all TID
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-i, --ignore-case match case insensitively
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
-r, --runstates <state> match runstates [D,S,Z,...]
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
中文翻譯:
root@ubuntu:/ky/boot# pgrep --help
用法:
pgrep [選項(xiàng)] <模式>
選項(xiàng):
-d, --delimiter <字符串> 指定輸出分隔符
-l, --list-name 列出PID和進(jìn)程名稱
-a, --list-full 列出PID和完整命令行
-v, --inverse 反轉(zhuǎn)匹配結(jié)果
-w, --lightweight 列出所有TID
-c, --count 統(tǒng)計(jì)匹配進(jìn)程的數(shù)量
-f, --full 使用完整進(jìn)程名稱進(jìn)行匹配
-g, --pgroup <PGID,...> 匹配指定的進(jìn)程組ID
-G, --group <GID,...> 匹配真實(shí)組ID
-i, --ignore-case 不區(qū)分大小寫進(jìn)行匹配
-n, --newest 選擇最近啟動(dòng)的進(jìn)程
-o, --oldest 選擇最早啟動(dòng)的進(jìn)程
-P, --parent <PPID,...> 僅匹配給定父進(jìn)程的子進(jìn)程
-s, --session <SID,...> 匹配會(huì)話ID
-t, --terminal <tty,...> 通過控制終端進(jìn)行匹配
-u, --euid <ID,...> 通過有效ID進(jìn)行匹配
-U, --uid <ID,...> 通過真實(shí)ID進(jìn)行匹配
-x, --exact 精確匹配命令名稱
-F, --pidfile <文件> 從文件中讀取PID
-L, --logpidfile 如果PID文件未鎖定,則失敗
-r, --runstates <狀態(tài)> 匹配運(yùn)行狀態(tài) [D,S,Z,...]
--ns <PID> 匹配與<pid>相同命名空間的進(jìn)程
--nslist <ns,...> 列出將用于--ns選項(xiàng)的命名空間
可用的命名空間:ipc, mnt, net, pid, user, uts
-h, --help 顯示此幫助信息并退出
-V, --version 輸出版本信息并退出
更多詳細(xì)信息請參閱pgrep(1)。
請注意,上面的<pattern>
是要匹配的進(jìn)程名稱或其他屬性的模式。可以根據(jù)實(shí)際情況替換為具體的值。
使用示例
以下是pgrep
命令不同選項(xiàng)的使用示例:
我們在這個(gè)容器中測試:
注意:我們首先要學(xué)會(huì)區(qū)分什么是進(jìn)程的進(jìn)程名!
進(jìn)程名就是那個(gè)進(jìn)程的可執(zhí)行文件,進(jìn)程名只有一個(gè),除去進(jìn)程名,其他的都是路徑和參數(shù)。
比如/bin/bash /usr/local/bin/entrypoint.sh
,進(jìn)程名是bash
root@5940438e0ee6:/build/libevent# echo "=====輸出所有進(jìn)程完整進(jìn)程信息:"
=====輸出所有進(jìn)程完整進(jìn)程信息:
root@5940438e0ee6:/build/libevent# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Jun27 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 7 1 0 Jun27 pts/0 00:02:56 ./kyai_rest
root 43 0 0 23:38 pts/1 00:00:00 /bin/bash
root 56 43 0 23:40 pts/1 00:00:00 ps -ef
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# echo "輸出所有進(jìn)程進(jìn)程名:"
=====輸出所有進(jìn)程進(jìn)程名:
root@5940438e0ee6:/build/libevent# ps -e -o comm=
bash
kyai_rest
bash
ps
root@5940438e0ee6:/build/libevent#
1. 列出匹配進(jìn)程的PID和進(jìn)程名稱(-l)(默認(rèn)只能從進(jìn)程名的子集字符串匹配,如果要使用完整進(jìn)程名的子集字符串匹配,請加-f參數(shù),下同)
pgrep -l <pattern>
pgrep --list-name <pattern>
示例:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l ky
7 kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l ./
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l ./ky
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -l -f ./ky
7 kyai_rest
2. 列出匹配進(jìn)程的PID和完整的命令行(-a)
pgrep -a <pattern>
pgrep --list-full <pattern>
示例:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a ky
7 ./kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a ./ky
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a -f ./ky
7 ./kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -af ./ky
7 ./kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a bash
1 /bin/bash /usr/local/bin/entrypoint.sh
43 /bin/bash
root@5940438e0ee6:/build/libevent#
3. 統(tǒng)計(jì)匹配進(jìn)程的數(shù)量(-c)
pgrep -c <pattern>
pgrep --count <pattern>
示例:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c ky
1
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c bash
2
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c ./ky
0
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -c -f ./ky
1
root@5940438e0ee6:/build/libevent#
4. 使用完整的進(jìn)程名稱(包括參數(shù))的子集進(jìn)行匹配(-f)(如果pattern跨越進(jìn)程命令與參數(shù),需要用雙引號(hào)括起來)★★★★★
pgrep -f <pattern>
pgrep --full <pattern>
比如有一個(gè)進(jìn)程全名為python3 -u /ky/alg/kyai/nv/m/people/alg/main.py
,用:
pgrep -f <pattern>
pattern為進(jìn)程全名的任意字符串子集,都能匹配到。
示例1
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -f ky
7
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -f ./ky
7
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep ./ky
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep /usr/local/bin/entrypoint.sh
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -f /usr/local/bin/entrypoint.sh
1
root@5940438e0ee6:/build/libevent#
示例2
5. 不區(qū)分大小寫進(jìn)行匹配(-i)
pgrep -i <pattern>
pgrep --ignore-case <pattern>
示例:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -i KyAi
7
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -i entry
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -i -f eNtry
1
root@5940438e0ee6:/build/libevent#
6. 選擇最近啟動(dòng)的進(jìn)程(n)
pgrep -n <pattern>
pgrep --newest <pattern>
示例:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a bash
1 /bin/bash /usr/local/bin/entrypoint.sh
43 /bin/bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a -n bash
43 /bin/bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -n bash
43
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
7. 選擇最早啟動(dòng)的進(jìn)程(-o)
pgrep -o <pattern>
pgrep --oldest <pattern>
示例:
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a bash
1 /bin/bash /usr/local/bin/entrypoint.sh
43 /bin/bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -a -o bash
1 /bin/bash /usr/local/bin/entrypoint.sh
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -o bash
1
root@5940438e0ee6:/build/libevent#
8. 僅匹配給定父進(jìn)程的子進(jìn)程(-P)
pgrep -P <PPID> <pattern>
pgrep --parent <PPID> <pattern>
示例:
比如0號(hào)進(jìn)程有1號(hào)何2號(hào)兩個(gè)子進(jìn)程:
用pgrep -P 0
能將0號(hào)進(jìn)程的子進(jìn)程找出來:
root@ubuntu:~#
root@ubuntu:~# pgrep -P 0
1
2
root@ubuntu:~#
在查找到時(shí)對(duì)子進(jìn)程篩選:
root@ubuntu:~#
root@ubuntu:~# pgrep -P 0 "system"
1
root@ubuntu:~#
root@ubuntu:~# pgrep -P 0 "thread"
2
root@ubuntu:~#
root@ubuntu:~#
注意:有時(shí)用-f參數(shù)從非進(jìn)程名的字符串段匹配篩選時(shí),注意雙引號(hào)的使用,以及使用雙引號(hào)后,仍應(yīng)注意的問題:
下面測試中:pgrep -f -P 0 --system
和pgrep -f -P 0 "--system"
都是報(bào)錯(cuò)的,只有pgrep -f -P 0 " --system"
沒出問題。
root@ubuntu:~#
root@ubuntu:~# pgrep -f -P 0 --system
pgrep: unrecognized option '--system'
Usage:
pgrep [options] <pattern>
Options:
-d, --delimiter <string> specify output delimiter
-l, --list-name list PID and process name
-a, --list-full list PID and full command line
-v, --inverse negates the matching
-w, --lightweight list all TID
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-i, --ignore-case match case insensitively
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
-r, --runstates <state> match runstates [D,S,Z,...]
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
root@ubuntu:~#
root@ubuntu:~# pgrep -f -P 0 "--system"
pgrep: unrecognized option '--system'
Usage:
pgrep [options] <pattern>
Options:
-d, --delimiter <string> specify output delimiter
-l, --list-name list PID and process name
-a, --list-full list PID and full command line
-v, --inverse negates the matching
-w, --lightweight list all TID
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-i, --ignore-case match case insensitively
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
-r, --runstates <state> match runstates [D,S,Z,...]
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# pgrep -f -P 0 " --system"
1
root@ubuntu:~#
root@ubuntu:~#
9. 通過控制終端進(jìn)行匹配(-t)
用途
指定特定終端名稱進(jìn)行搜索的用途之一是限定搜索范圍。在多用戶或多終端環(huán)境中,可能會(huì)有多個(gè)終端同時(shí)運(yùn)行著相同的進(jìn)程。通過指定終端名稱,你可以僅在特定終端中搜索匹配的進(jìn)程,而不是在所有終端中搜索。
這對(duì)于需要在特定終端上執(zhí)行操作或監(jiān)控特定終端上的進(jìn)程非常有用。例如,你可能希望在某個(gè)特定的終端上查找正在運(yùn)行的某個(gè)應(yīng)用程序的進(jìn)程,或者在某個(gè)特定的終端上查找與某個(gè)用戶相關(guān)的進(jìn)程。
另外,指定終端名稱還可以用于在腳本或自動(dòng)化任務(wù)中進(jìn)行進(jìn)程管理。通過指定特定的終端,你可以確保只對(duì)特定終端上的進(jìn)程進(jìn)行操作,而不會(huì)影響其他終端上的進(jìn)程。
總而言之,指定特定終端名稱進(jìn)行搜索可以提供更精確和有針對(duì)性的進(jìn)程查找和管理。
命令
pgrep -t <tty> <pattern>
pgrep --terminal <tty> <pattern>
測試步驟
按照以下步驟進(jìn)行測試:
- 打開終端。
- 運(yùn)行
tty
命令,獲取當(dāng)前終端的名稱。例如,如果終端名稱是/dev/tty1
,則將<tty>
替換為tty1
。 - 運(yùn)行
pgrep -t <tty> <pattern>
命令,將<pattern>
替換為你想要查找的進(jìn)程名稱或關(guān)鍵字。例如,如果你想要查找所有運(yùn)行著的bash
進(jìn)程,可以運(yùn)行pgrep -t tty1 bash
。 - 如果命令成功執(zhí)行,它將輸出匹配的進(jìn)程 ID。
- 你也可以嘗試運(yùn)行
pgrep --terminal <tty> <pattern>
命令,它與上述命令的作用相同。
請注意,pgrep
命令用于在進(jìn)程列表中查找匹配的進(jìn)程,并輸出它們的進(jìn)程 ID。<tty>
是終端名稱,<pattern>
是要查找的進(jìn)程名稱或關(guān)鍵字。你需要根據(jù)你的實(shí)際情況替換這些參數(shù)。
示例
root@ubuntu:~#
root@ubuntu:~# tty
/dev/pts/0
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# pgrep -t /dev/pts/0 bash
root@ubuntu:~#
root@ubuntu:~# pgrep -t /dev/pts/0 sy
root@ubuntu:~#
root@ubuntu:~# pgrep -t /dev/pts/0
root@ubuntu:~#
root@ubuntu:~# pgrep -t "/dev/pts/0"
root@ubuntu:~#
root@ubuntu:~# pgrep -t "/dev/pts/0" bash
root@ubuntu:~#
root@ubuntu:~#
尷尬,我這啥也搜不出來
10. 通過有效ID進(jìn)行匹配(-u)
用途
pgrep -u <ID> <pattern>
和 pgrep --euid <ID> <pattern>
命令用于在指定用戶 ID 或有效用戶 ID 下查找匹配的進(jìn)程。
-
<ID>
參數(shù)用于指定用戶 ID 或有效用戶 ID。你可以使用用戶的用戶名或用戶 ID 來替換<ID>
。 -
<pattern>
參數(shù)用于指定要查找的進(jìn)程名稱或關(guān)鍵字。
命令
pgrep -u <ID> <pattern>
pgrep --euid <ID> <pattern>
測試步驟
- 打開終端。
- 運(yùn)行
id
命令,獲取當(dāng)前用戶的用戶 ID 和有效用戶 ID。例如,如果用戶 ID 是1000
,有效用戶 ID 是1000
,則將<ID>
替換為1000
。 - 運(yùn)行
pgrep -u <ID> <pattern>
命令,將<pattern>
替換為你想要查找的進(jìn)程名稱或關(guān)鍵字。例如,如果你想要查找當(dāng)前用戶下所有運(yùn)行著的bash
進(jìn)程,可以運(yùn)行pgrep -u 1000 bash
。 - 如果命令成功執(zhí)行,它將輸出匹配的進(jìn)程 ID。
- 你也可以嘗試運(yùn)行
pgrep --euid <ID> <pattern>
命令,它與上述命令的作用相同。
請注意,pgrep
命令用于在進(jìn)程列表中查找匹配的進(jìn)程,并輸出它們的進(jìn)程 ID。-u
或 --euid
選項(xiàng)用于指定用戶 ID 或有效用戶 ID。<ID>
是用戶 ID 或有效用戶 ID,<pattern>
是要查找的進(jìn)程名稱或關(guān)鍵字。你需要根據(jù)你的實(shí)際情況替換這些參數(shù)。
示例
root@ubuntu:~#
root@ubuntu:~# id
uid=0(root) gid=0(root) groups=0(root)
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# pgrep -u 0000 bash
3058
3955
23187
root@ubuntu:~#
root@ubuntu:~# pgrep -u 0 bash
3058
3955
23187
root@ubuntu:~#
root@ubuntu:~# pgrep -u 1000 bash
root@ubuntu:~#
root@ubuntu:~# ps -ef | grep bash
root 1061 1 0 19:27 ? 00:00:00 /bin/bash /etc/systemd/nvmemwarning.sh
root 1260 1 0 19:28 ? 00:00:00 /bin/bash /ky/boot/kyai_nv_server.sh
root 1276 1 0 19:28 ? 00:00:00 /bin/bash /etc/systemd/nvgetty.sh
root 3058 2914 0 19:28 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 3955 3915 0 19:28 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 23187 23106 0 21:46 pts/0 00:00:00 -bash
root 36607 23187 0 23:39 pts/0 00:00:00 grep --color=auto bash
root@ubuntu:~#
root@ubuntu:~#
11. 通過真實(shí)ID進(jìn)行匹配(-U)
具體請參見有效id和真實(shí)id,我目前還不是很理解。
命令
pgrep -U <ID> <pattern>
pgrep --uid <ID> <pattern>
示例
root@ubuntu:~#
root@ubuntu:~# pgrep -U 0000 bash
3058
3955
23187
root@ubuntu:~#
root@ubuntu:~#
12. 精確匹配命令名稱(-x)★★★
命令
pgrep -x <pattern>
pgrep --exact <pattern>
示例
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 19:28 pts/0 00:00:00 /bin/bash /usr/local/bin/entrypoint.sh
root 8 1 0 19:28 pts/0 00:00:39 ./kyai_rest
root 41 0 0 23:45 pts/1 00:00:00 /bin/bash
root 54 41 0 23:46 pts/1 00:00:00 ps -ef
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x kyai
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x kyai_rest
8
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f kyai_rest
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f ./kyai_rest
8
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x bash
1
41
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f bash
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f /bin/bash
41
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f /bin/bash /usr/local/bin/entrypoint.sh
pgrep: only one pattern can be provided
Try `pgrep --help' for more information.
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent# pgrep -x -f "/bin/bash /usr/local/bin/entrypoint.sh"
1
root@5940438e0ee6:/build/libevent#
root@5940438e0ee6:/build/libevent#
注意:精準(zhǔn)匹配,是包含參數(shù)的所有完整匹配文章來源:http://www.zghlxwxcb.cn/news/detail-734107.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-734107.html
到了這里,關(guān)于linux shell pgrep命令使用方法(pgrep指令)獲取進(jìn)程號(hào)、統(tǒng)計(jì)進(jìn)程數(shù)量(學(xué)會(huì)區(qū)分Linux進(jìn)程進(jìn)程名)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!