Thursday, May 2, 2024
17
rated 0 times [  17] [ 0]  / answers: 1 / hits: 79768  / 2 Years ago, fri, may 27, 2022, 3:14:14

I'm a newbie to shell programming. Assuming that I've started a program(eg NetBeans) from my terminal, if I type



ps aux|grep netbeans


I get the the output



pre      18775  1.2  0.0  12524  1972 pts/3    S    20:17   0:00 


where 18775 specifies the PID etc of the process.



Then I kill it using



kill 18775.


upon which the NetBeans UI disappears. If I try to get the pid by using the first command, I still get:



pre      19137  0.0  0.0   9136  1068 pts/3    S+   20:19   0:00 grep --color=auto netbeans


If the process has been killed, why does it still show the above output?


More From » command-line

 Answers
2

grep is grepping itself. Try something like:



ps aux |grep [n]etbeans


this keeps grep from showing itself in the output


[#41997] Saturday, May 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oileweaty

Total Points: 337
Total Questions: 108
Total Answers: 105

Location: Western Sahara
Member since Mon, May 3, 2021
3 Years ago
oileweaty questions
Thu, Jul 1, 21, 01:57, 3 Years ago
Wed, Nov 24, 21, 11:48, 2 Years ago
Sat, May 14, 22, 00:50, 2 Years ago
;