pgrep does not search for long (more than 15 chars) process name

635 views Asked by At

My process name is core-plugin-loader

core-plugin-loader --file=/usr/lib/blah.so &

pi@kyb-pi4 /usr> pgrep core-plugin-loader
pi@kyb-pi4 /usr> pgrep core-plugin-loa
13892
pi@kyb-pi4 /usr> pgrep -a core-plugin-loa
13892 core-plugin-loader --file=/usr/lib/blah.so
pi@kyb-pi4 /usr> pgrep -a core-plugin-loader

Version:

pgrep from procps-ng 3.3.15

> head -1 /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"

Looks very strange. How to fix this for pgrep?

Here is Q about thread name. But I ask for a process name.

1

There are 1 answers

0
Philippe On BEST ANSWER

This seems to be in man pgrep :

NOTES

The process name used for matching is limited to the 15 characters present in the output of /proc/pid/stat. Use the -f option to match against the complete command line, /proc/pid/cmdline.