LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2017, 06:39 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, USA
Distribution: Centos 7 , Linux Mint 18.1 Under VMware in Win7
Posts: 515

Rep: Reputation: 34
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
 
Old 02-04-2017, 06:56 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,410

Rep: Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057Reputation: 3057
If you know the full name, use "-C" - documented in the manpage.
If not, pipe it to grep.
 
Old 02-04-2017, 07:31 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
If you know the process name, just ask for the pid using
Code:
pidof <process>
 
Old 02-05-2017, 12:14 AM   #4
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
pgrep is also handy
 
Old 02-05-2017, 12:40 AM   #5
erik2282
Member
 
Registered: May 2011
Location: TX
Distribution: Debian
Posts: 768

Rep: Reputation: 223Reputation: 223Reputation: 223
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
 
Old 02-07-2017, 06:04 AM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,994
Blog Entries: 1

Rep: Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [SOLVED] bash script: can echo command, command works if I type, but command doesn't work in script ... why? hopeless_n00b Linux - Newbie 10 07-12-2018 06:57 AM
Does bash script has equivalent set /p command as Windows shell command? ncheng Linux - Newbie 5 06-30-2016 06:29 AM
Command/Script required to send an email alert in case command will not respond rajaniyer123 Linux - General 1 05-19-2012 02:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 04:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration