Re: how to get the pid from ps
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Wed, 26 Jul 2006 18:12:36 -0400
On 2006-07-26, john_woo@xxxxxxxxxx wrote:
Hi,
the output from ps -ef | grep my.jar is:
root 2343 1 0 Jul27 ? 00:00:00
/usr/java/jdk1.5.0_06/bin/java -classpath /usr/local/my.jar: com.Server
/usr/local/logger.property
root 4194 2969 0 01:36 pts/1 00:00:00 grep my.jar
I'm wondering, how to get the 2343 and how to know no such program
running?
I'v tried ps -ef | grep my.jar | cut -f1,2,3 -d' ' but it output:
Remove multiple spaces:
ps -ef | grep '[m]y.jar' | tr -s ' ' | cut -f1,2,3 -d' '
Also, most modern versions of ps allow you to select which fields
you want printed:
ps -eo user,pid,gid,comm | grep '[m]y.jar'
root
root
Toronto
Ditto.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
.
- Follow-Ups:
- Re: how to get the pid from ps
- From: John L
- Re: how to get the pid from ps
- References:
- how to get the pid from ps
- From: john_woo
- how to get the pid from ps
- Prev by Date: Re: UNIX, SQL Loader
- Next by Date: Re: "setenv EDITOR vi" don't work
- Previous by thread: how to get the pid from ps
- Next by thread: Re: how to get the pid from ps
- Index(es):
Relevant Pages
|