Jump to content

PID - how to get it?


aze
 Share

Recommended Posts

several ways, my favorite is (replace 'cupsd' with the name of the program you want to know its pid):

[arusabal@localhost ~]$ ps aux | awk '/[c]upsd/ {print $2}'

1043

[arusabal@localhost ~]$

see "man ps".

If you dont use the "[c]" at the awk expression (same with grep...) you'll get two pids, one for cupsd and another for awk.

There are dozens of variants of the above command.

 

as root you can do:

pidof name

 

as normal user you'll need to invoque the full path of pidof:

[arusabal@localhost ~]$ /sbin/pidof cupsd

1043

[arusabal@localhost ~]$

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...