pgrep uses regex as pattern style. I miss the -i option of grep, to tell pgrep, that I am searching case insensitive.
An alternative is
ps ax | grep -i PATTERN
But then I have to use the PID to send a KILL signal. With the pgrep and pkill combo I can use the same pattern for killing the app.
How can I use regex's REG_ICASE on the fly on the bash?
Case insensitive SQL SELECT: Use upper or lower functions select * from users where lower(first_name) = 'fred'; As you can see, the pattern is to make the field you're searching into uppercase or lowercase, and then make your search string also be uppercase or lowercase to match the SQL function you've used.
Case Insensitive Search By default, grep is case sensitive. This means that the uppercase and lowercase characters are treated as distinct. To ignore case when searching, invoke grep with the -i option (or --ignore-case ).
You can also type command -I while less is running. It toggles case sensitivity for searches. -i means ignore case in searches that do not contain uppercase while -I ignores case in all searches.
Case-insensitive file searching with the find command The -iname option is what makes the search case-insensitive.
If the string is not too long:
pkill -f '[Pp][Aa][Tt][Ee][Rr][Nn]'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With