How to get pgrep to display full process info

pgrep's output options are pretty limited. You will almost certainly need to send it back through ps to get the important information out. You could automate this by using a bash function in your ~/.bashrc.

function ppgrep() { pgrep "$@" | xargs --no-run-if-empty ps fp; }

Then call the command with.

ppgrep <pattern>

Combine pgrep with ps using xargs!

pgrep <your pgrep-criteria> | xargs ps <your ps options> -p

For example try

pgrep -u user | xargs ps -f -p

to get a full process list of user. Option -u user limits pgrep to the user given (as a number or name) while the ps options -f -p request a full format listing for the selected PID.

It's nice that you keep the first line with the column names. grep always drops the column names.