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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...