LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-16-2011, 03:10 AM   #1
emagnun
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
Question Using the command ps


Hi,

This is regarding the usage of "ps" command.

I want to select all processes for which the command is "myProg" and
the user is alex. Also i want the output in such a way that only
process ids are displayed.

This is the command that i used => ps -C myProg -o pid=

But it lists pid's of all "myProg" processes. ie it contains "myProg"
processes which are spawned by alex and other users as well.

How can i modify the above command so that it can print only alex's
"myProg" processes..

Pls help me..
 
Old 03-16-2011, 03:19 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello and Welcome to LinuxQuestions,

Have a look at the man page for ps:
Code:
man ps
more in particular the -u option.

Kind regards,

Eric
 
Old 03-16-2011, 04:01 AM   #3
emagnun
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Hi Eric,

Thanks for the quick reply. I can use pgrep for this. The command [pgrep -x myProg -u alex] will do that. But i want to do this with ps only.

Also processes can be selected by 'user' => ps -u alex -o pid=
But i want do to combine both. ie the commands [ps -u alex -o pid=] and [ps -C myProg -o pid=] should be combined.

Pls guide me.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 11:21 AM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 01:31 PM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 02:14 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM
Turning a Ruby on Rails Ubuntu command into a Redhat command Mangalaiii Red Hat 1 12-02-2008 03:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:28 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