Kalanidhi
Kalanidhi

Reputation: 5092

Find the process id of the process name

I know to find the process id of the process name using the top, pidof, ps commands. Anyother way to find the process id of the process name. Thanks in Advance.

For example:

        pidof bash 
        4587

Upvotes: 1

Views: 195

Answers (2)

Gaurav Dave
Gaurav Dave

Reputation: 7474

You can also use this:

ps -A | grep 'process_name'

You can refer: ps command for more information

Upvotes: 2

jkshah
jkshah

Reputation: 11703

Probably you are looking for pgrep

pgrep bash

Another option

ps -ef | grep sshd | grep -v 'grep' | awk '{print $2}'

Upvotes: 1

Related Questions