Skip to content

Instantly share code, notes, and snippets.

@hovsater
Last active December 14, 2015 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hovsater/5003408 to your computer and use it in GitHub Desktop.
Save hovsater/5003408 to your computer and use it in GitHub Desktop.
Finding processes with pgrep

Ever so often I want to find a particular process on the system. I've always accomplished this by doing ps -ef | grep PROCESS_NAME.

Today, I stumpled upon a new command by coincidence. The pgrep command. By spending a few minutes reading its documentation (man pgrep) I realized what it's capable of.

Run pgrep -i PROCESS_NAME to find processes. The -i flag tells pgrep to perform case insensitive matching.

Run pgrep -ilf PROCESS_NAME to get long output, including the argument list of the matching process.

From now, this is what I'll be using.

Happy hacking!

GitHub: KevinSjoberg | Twitter: KevinSjoberg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment