Linux – How to get pgrep to display full process info

bashgreplinuxprocess

Is there any way to get pgrep to give me all the info about each process that ps does? I know I can pipe ps through grep but that's a lot of typing and it also gives me the grep process itself which I don't want.

Best Answer

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>