The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep command christine33990 UNIX for Dummies Questions & Answers 11 05-06-2008 02:45 AM
how to exclude the GREP command from GREP yamsin789 UNIX for Advanced & Expert Users 2 10-05-2007 02:59 AM
grep command help ishmael^soyuz Shell Programming and Scripting 4 07-11-2007 09:01 AM
grep command pmsuper UNIX for Dummies Questions & Answers 6 11-22-2006 07:12 AM
grep command debasis.mishra Shell Programming and Scripting 1 03-28-2006 01:53 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-07-2008
Sayantan Sayantan is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 5
ps | grep command

Hi All,
Looking for an explanation.

[sayantan:~/mydir$] ps -ef |grep sandipan
sayantan 18975 18550 97 14:54 pts/3 00:00:17 ./sandipan
sayantan 18981 3700 0 14:54 pts/4 00:00:00 grep sandipan


[sayantan:~/mydir$] ps -ef |grep sandipan
sayantan 18975 18550 97 14:54 pts/3 00:00:17 ./sandipan
  #2 (permalink)  
Old 01-07-2008
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
When you run "grep sandipan" that becomes an entry in the process listing.

Whether you see it or not depends on whether ps completes before the shell execs the grep.

"|" means that processes are executed in parallel, they may or may not actually overlap depending on the scheduler.
  #3 (permalink)  
Old 01-07-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
how about:
Code:
ps -ef | grep -v grep | grep sandipan
of course we're wasting some cpu time by forking one more grep
  #4 (permalink)  
Old 01-07-2008
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by Yogesh Sawant View Post
how about:
Code:
ps -ef | grep -v grep | grep sandipan
of course we're wasting some cpu time by forking one more grep
Or

Code:
ps -ef | grep '[s]andipan'
  #5 (permalink)  
Old 01-07-2008
gus2000 gus2000 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 157
Yes, but now you can't grep for ANY command with the word "grep" in it. How about:

Code:
ps -ef | grep -v " $$ .*grep " | grep sandipan

Last edited by gus2000; 01-07-2008 at 02:11 PM..
  #6 (permalink)  
Old 06-07-2009
harlock59's Avatar
harlock59 harlock59 is offline
Registered User
  
 

Join Date: May 2009
Location: France
Posts: 11
Cool

Hello,

i would like to find the name or the pid of the process that is using my /var/lib/dpkg/lock file.

how can i do that ?

thanks.
Reply

Bookmarks

Tags
grep, regex

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0