pgrep pkill fulltext process name search

Problem with pgrep and pkill

Adding the -f option to pgrep and pkill searches the whole command line, instead of the default first 15 characters. This is useful for example with chromium-browser that actually lists in ps as /usr/lib/chromium-browser/chromium-browser–too long for pgrep and pkill default to find.

pgrep -f chromimum

works, while

pgrep chromium

does not work with default settings.

Fix this problem

You can make this change persistent by adding these lines to ~/.bash_aliases

alias pgrep="pgrep -f"
alias pkill="pkill -f"

Example of find/SIGTERM process by name

These examples are for Chromium

find running process by name

pgrep chromium

returns the PID (integer).

SIGTERM running process by name

pkill chromium




Leave a Comment