Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道使用 top、pidof、ps 命令来查找进程名称的进程 ID。找到进程名称的进程ID的任何其他方式。提前致谢。
例如:
pidof bash 4587
你也可以使用这个:
ps -A | grep 'process_name'
更多信息可以参考:ps命令
可能你正在寻找pgrep
pgrep
pgrep bash
另外一个选项
ps -ef | grep sshd | grep -v 'grep' | awk '{print $2}'