LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using the PS Command (https://www.linuxquestions.org/questions/linux-newbie-8/using-the-ps-command-4175599005/)

swamprat 02-04-2017 05:39 PM

Using the PS Command
 
Greetings,

How do you use the PS command to see if a particular program (demon) is running.

PS -ef gives a whole lot of information but it's just to much and I only am looking for one program.

Thanks

syg00 02-04-2017 05:56 PM

If you know the full name, use "-C" - documented in the manpage.
If not, pipe it to grep.

Habitual 02-04-2017 06:31 PM

If you know the process name, just ask for the pid using
Code:

pidof <process>

Doug G 02-04-2017 11:14 PM

pgrep is also handy

erik2282 02-04-2017 11:40 PM

http://linuxcommand.org/man_pages/ps1.html

example:

Code:

erik@mymachine:~$ ps aux | grep erik | grep kde
erik      328  0.0  0.0  10700  340 ?        Ss  17:51  0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/bin/startkde
erik      331  0.0  0.0  24504  1828 ?        S    17:51  0:00 /usr/bin/dbus-launch --exit-with-session /usr/bin/startkde
erik      372  0.0  0.0  4084    80 ?        S    17:51  0:00 /usr/lib/kde4/libexec/start_kdeinit +kcminit_startup
erik      373  0.0  0.3 404084 62120 ?        Ss  17:51  0:00 kdeinit4: kdeinit4 Running...                 
erik      374  0.0  0.2 410356 39884 ?        S    17:51  0:00 kdeinit4: klauncher [kdeinit] --fd=9         
erik      376  0.0  0.4 1492000 68532 ?      Sl  17:51  0:01 kdeinit4: kded4 [kdeinit]                     
erik      601  0.0  0.3 594248 51680 ?        Sl  17:51  0:00 kdeinit4: ksmserver [kdeinit]                 
erik      606  0.0  0.1 386852 30292 ?        Sl  17:51  0:00 /usr/lib/kde4/libexec/kdeconnectd
erik      1251  0.0  0.2 395744 33460 ?        Sl  17:51  0:00 /usr/lib/kde4/libexec/polkit-kde-authentication-agent-1
erik      3532  0.0  0.0  12732  2280 pts/0    S+  23:39  0:00 grep kde
erik    32753  0.0  0.0  4336  1572 ?        Ss  17:51  0:00 /bin/sh /usr/bin/startkde


Shadow_7 02-07-2017 05:04 AM

Note that it's "ps" and not "PS", linux is case sensitive.

$ COLUMNS=300 ps -FlAw | grep -i X

And +1 to pgrep being useful.

$ kill -9 $(pgrep chrome)

Poor mans killall. Or at least for those too lazy / underprivileged to install killall.


All times are GMT -5. The time now is 10:07 PM.