LinuxQuestions.org
Review your favorite Linux distribution.
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, 05:39 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, USA
Distribution: VMware V12 and V15 in Windows 10, MX Linux 23.1, Kubuntu 23.10, IBM z/VM 5.4
Posts: 559

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, 05:56 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,251

Rep: Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159Reputation: 4159
If you know the full name, use "-C" - documented in the manpage.
If not, pipe it to grep.
 
Old 02-04-2017, 06:31 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
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-04-2017, 11:14 PM   #4
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
pgrep is also handy
 
Old 02-04-2017, 11:40 PM   #5
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 833

Rep: Reputation: 229Reputation: 229Reputation: 229
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, 05:04 AM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875Reputation: 875
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 05:57 AM
Does bash script has equivalent set /p command as Windows shell command? ncheng Linux - Newbie 5 06-30-2016 05:29 AM
Command/Script required to send an email alert in case command will not respond rajaniyer123 Linux - General 1 05-19-2012 01:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 03:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 11:21 AM

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

All times are GMT -5. The time now is 06:43 PM.

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
Open Source Consulting | Domain Registration