Mabe the process name is too long for pgrep then use pgrep -f (run on the full args).
---------- Post updated at 14:41 ---------- Previous update was at 13:52 ----------
In your post both the second grep(-only) does list the grep process and nothing else!?
--
The following uses the [ ] trick to not find itself (its own arguments) in the ps list.
While [ ] can contain any of the characters, a literal dot is preferred because it also changes the wildcard dot (regular expression!) into a literal dot.
These 2 Users Gave Thanks to MadeInGermany For This Post:
Hi,
I want to grep within a script for a process.
The problem is I just no the name of the process not its location.
I tried the following:
ps -ef | grep demo
but than I get also processes which run from the directory demo or where I file like demo.c is open.
So I am searching for... (3 Replies)
Soz im a bit newbie...
I want to do:
ps -A | grep firefox | kill $1
it should kill the pid associated, but it doesnt work.
$1 is the pid (if i do a awk {'print $1'} i get it ) , but kill doesnt take it as such...
How can i do it? (3 Replies)
Dear All,
I plan to write a script and in the beginning, I will check if there's any existing previous process running, if YEs, then exit directly, if Not, then continue.
#!/bin/bash
NUM=`ps -ef | grep $0 | grep -v grep | wc -l`
ps -ef | grep $0 | grep -v grep
echo "NUM ==> $NUM"
if... (6 Replies)
Hi
I want to write a shell script which can find the process id's of all the process and kill them eg:
ps ax | grep rv_
3015 ? S 0:00 /home/vivek/Desktop/rv_server
3020 ? S 0:00 /home/vivek/Desktop/rv_gps
3022 ? S 0:00 /home/vivek/Desktop/rv_show
... (7 Replies)
Hey all,
I got some help last week and It will temporarily work
We have a certain process that runs several processes within it. Here is an example:
Date - 0:04 process1-database: db (state)
Date - 0:04 process1-database: db (state)
Date - 0:04... (8 Replies)
Can I modify the grep command to show only a process name?
Currently I run ps -efa | grep chk_web to get the following:
mousr 3395 1 0 09:36:06 pts/10 0:00 sh /var/opt/scripts/chk_web.sh
Can this be changed in any way to get only:
/var/opt/scripts/chk_web.sh or chk_web.sh.
I... (3 Replies)
Hi How to grep the process id and take it as a variable.i tried to get the value 9953 to a variable and could not with my little bit of linux exp,can any one help
netstat -ptlen | grep 10000
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 0 ... (3 Replies)
Hi,
I am trying to get the PID of a process that is defunct. I have two quesitons on this.
1) how do I pass in two strings? This is what I am using now:
ps -ef |egrep -i "programname|<defunct>"
But this returns multiple results with the word defunct in them.
2) How do I make it so that... (1 Reply)
Hello,
I want to grep a specific process named "TEST" in AIX but not only is it showing what I want but also listing others that have the similar name. How can I only list "TEST"? I've tried using options grep -w with no change and grep -o isn't supported in my environment.
Please advise.
... (6 Replies)
I have user1 run a script called logginexpert.sh while has this line of code
sleep 888I then login to another putty session with another user2 and try to grep for the logginexpert.sh process using
ps -ef | grep exSunOS mymac 5.11 11.2 sun4u sparc SUNW,SPARC-Enterprise
But, i dont get any... (20 Replies)
Discussion started by: mohtashims
20 Replies
LEARN ABOUT HPUX
zgrep
ZGREP(1) General Commands Manual ZGREP(1)NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)ZGREP(1)