0

I can grep my processes:

ladislav@cool:~$ ps aux | grep "node example.js"
ladislav   18231  0.1  0.3 11116444 50812 ?      Ssl  22:46   0:00 node example.js server m 0 found
ladislav   18257  0.0  0.0  11600   712 pts/0    S+   22:49   0:00 grep --color=auto node example.js

But I want to get rid of the second line. I tried following command which works:

ladislav@cool:~$ ps aux | grep "\bnode example.js"
ladislav   18231  0.0  0.3 11116444 50812 ?      Ssl  22:46   0:00 node example.js server m 0 found

Could someone explain why or how it works? I don't understand it. I think it should not work.

tlama
  • 607
  • 1
  • 10
  • 17
  • Does this answer your question? [What is a word boundary in regex?](https://stackoverflow.com/questions/1324676/what-is-a-word-boundary-in-regex) – Julia Dec 19 '22 at 22:20

1 Answers1

0

Better do this:

pgrep -fl node example.js

It's especially designed for this task.

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223