Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 4514  / 3 Years ago, fri, june 18, 2021, 3:41:35

pgrep returns nothing if the pattern length is longer than 15 characters.
I can't find anything in the man page about maximum pattern length.



Is this a bug?



for purposes of exposition I created a process called 12345678901234567890



$ pgrep 12345678901234
5367
$ pgrep 123456789012345
5367
$ pgrep 1234567890123456
$

More From » process

 Answers
6

I think it's not a limit on the pattern length in pgrep itself, but a limit on the length of the comm (command) field in the /proc/[pid]/stat files (which is where the information in ps comes from).



According to man proc, the definitions for /proc/[pid]/stat come from /usr/src/linux/fs/proc/array.c so you would need to look there for a definitive answer.


[#28934] Saturday, June 19, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
enincroscope

Total Points: 252
Total Questions: 124
Total Answers: 104

Location: Tajikistan
Member since Thu, Apr 14, 2022
2 Years ago
;