/ps Display Width in OS X

ps Display Width in OS X

In one of my OS X scripts, I used the following to check the running process.

ps -aux | grep '/etc/bkupexec/agent.be'

However, it doesn’t always work. I didn’t know exactly why. On one occasion, I found that if I run the script in a wide window and it works every time. I knew that it’s related to the window size then. How do I set it so that the script runs regardless the window size. The answer is right in the manual page.

-w      Use 132 columns to display information, instead of the default

        which is your window size.  If the -w option is specified more

        than once, ps will use as many columns as necessary without

        regard for your window size.

After I changed the script to

ps -auxww | grep '/etc/bkupexec/agent.be'

, it runs flawlessly every time.