Reputation: 1679
I can get the PID of a specific process name by
pidof$(ps -C netns)
but what if I don't know the name of the process exactly? I can't type something like
pidof$(ps -C net*)
so is there any wildcard character, or is there another solution?
Upvotes: 2
Views: 3263
Reputation: 30803
Just use pgrep -l
, eg:
$ pgrep -l sh
1821 sshd
2590 ssh-agent
2658 sh
2677 bash
3025 gvfsd-trash
14785 ksh93
17723 ksh93
Upvotes: 3
Reputation: 3519
try the following and see if you can discover the process as such
This will give you all processes for all users, in a full-format listing
ps auxf
where :
if the list is too long you can filter if you have an idea of the process name
For example the command below will show you the pids for chrome.
ps auxf | grep chrome
Upvotes: 0
Reputation: 1405
Use the -A
(all processes) option and filter the result through grep
:
pidof $(ps -A | grep "net*")
Upvotes: 4