Skip to main content

Use grep's --color option to make arguments pop in ps output

The Problem

You would like to locate all purge processes that are running:

ps aux | grep purge

You'd specifically like to see the --dir= argument passed to each purge process. However, "ps aux" output is cluttered and the arguments are hard to locate with the human eye, especially if a lot of purge processes are running.

The Solution

Output the entire --dir= argument in bold text via grep's --color option.

> ps aux|grep purge|grep --color -E '\-\-dir=[^ ]+'

root       861  0.0  0.0   8040  1356 ?        Ss   10:55   0:00 /bin/sh -c /usr/bin/nice /local/quantum/exec.sh --release-dir=/common/release --release-path=factory/purge -@- purge.pl --dir=/common/reporting --max-age='20 days' --max-uncompressed-age='10 days' --no-test --tee-path='/qnmlog/log/purge/reporting/$P' >/dev/null 2>&1 

root     31061  0.0  0.0   8040  1352 ?        Ss   16:00   0:00 /bin/sh -c /usr/bin/nice /local/quantum/exec.sh --release-dir=/common/release --release-path=factory/purge -@- purge.pl --dir=/common/factories --max-age='60 days' --max-uncompressed-age='30 days' --no-test --tee-path='/qnmlog/log/purge/$P' 1>/dev/null 2>&1 

Comments

Popular posts from this blog

Running 2560x1080 on LG 29UM57-P on an old MacBook Pro OSX El Capitan

Yes. A mid-2011 MacBook Pro running OSX El Capitan can drive a 2560x1080 monitor via HDMI. I was not able to get 60 Hz working. I am settling with 53 Hz. I tried many settings before finding something that works. The refresh rate seems fine to me. Maybe the text could be clearer but for a $200 monitor running this resolution, I'll take it. Apple MacBook 2015 retina resolution is 2560 x 1800. Consider buying a better monitor that may literally give you fewer headaches. Install  SwitchResX Follow the instructions for disabling SIP After rebooting, run SwitchResX via System Preferences Select your LG monitor Click Custom Resolutions Click the + icon  Enter these settings  ( source ) Exit SwitchResX and save Reboot Run SwitchResX via System Preferences Select your LG monitor Click Current Resolutions Select the 2560x1080, 53 Hz setting Enable SIP If you discover better settings, please leave a comment.