![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep exclude/find single and double quotes | Lindy_so | UNIX for Dummies Questions & Answers | 4 | 03-06-2008 05:01 AM |
| grep command help | geekeezoid | UNIX for Dummies Questions & Answers | 15 | 04-16-2007 08:55 PM |
| grep command | mahabunta | Shell Programming and Scripting | 2 | 09-13-2006 12:11 AM |
| grep - to exclude lines beginning with pattern | frustrated1 | Shell Programming and Scripting | 2 | 08-29-2005 04:18 AM |
| grep command ~ Need help | april04 | Shell Programming and Scripting | 6 | 10-23-2002 12:57 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
how to exclude the GREP command from GREP
I am doing "ps -f" to see my process.
but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude [root@localhost ~]# ps -f UID PID PPID C STIME TTY TIME CMD root 15794 15792 0 13:48 pts/2 00:00:00 -bash root 16157 15794 0 14:01 pts/2 00:00:00 ps -f [root@localhost ~]# ps -f | grep -v ps UID PID PPID C STIME TTY TIME CMD root 15794 15792 0 13:48 pts/2 00:00:00 -bash root 16160 15794 0 14:02 pts/2 00:00:00 -bash while all I want is to get my pid line only. or maybe you know another command that returns my pid and ppid only ? thanks |
| Forum Sponsor | ||
|
|
|
||||
|
how 'bout
Code:
echo "myPID->[$$] PPID->[$PPID]" Code:
echo "myPID->[$$] PPID->[`ps -o ppid= -p $$`]" Last edited by vgersh99; 10-04-2007 at 02:19 PM. |
|
|||
|
Quote:
Code:
[root@dns ~]# uname -a Linux dns 2.6.22.5-76.fc7 #1 SMP Thu Aug 30 13:47:21 EDT 2007 i686 athlon i386 GNU/Linux [root@dns ~]# ps -f | grep -v ps UID PID PPID C STIME TTY TIME CMD root 2593 2572 0 Oct04 pts/1 00:00:00 -bash can you check this out: [root@dns ~]# ps -f | grep -v ps |grep -v grep UID PID PPID C STIME TTY TIME CMD root 2593 2572 0 Oct04 pts/1 00:00:00 -bash |
|||
| Google The UNIX and Linux Forums |