?
Solved

using ps with grep shows grep as a process

Posted on 2003-03-27
5
Medium Priority
?
537 Views
Last Modified: 2013-12-26
Hi there,

I am executing the following command:
ps -auxww | grep <process_name>
and after I run this it shows the process name but it also shows grep as a process and I don't want that. How could I prevent showing grep as a process
Thanks.
0
Comment
Question by:nikolap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 1000 total points
ID: 8216599
ps -auxww | grep <process_name> |grep -v grep
0
 
LVL 7

Expert Comment

by:glassd
ID: 8217957
Neater solution:
ps -auxww | grep [p]rocess_name

The grep process will have embedded square brackets which the grep will fail to match.
0
 
LVL 3

Expert Comment

by:prady_21
ID: 8222481
ps -auxww | grep ps

0
 
LVL 2

Expert Comment

by:bkrahmer
ID: 8223346
You didn't mention what platform you are on.  Some really nice ones (Solaris!) give you things like pgrep.  Does all the nasty for you.

brian
0
 
LVL 7

Expert Comment

by:glassd
ID: 8223549
pgrep is fine if you are running a late version of solaris and want the PID. If you are running a multiplatform environment, possibly with older versions of solaris, or want some other info (eg PPID) then you are often better sticking to the more generic forms in scripts. You can get a job anywhere then!!
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question