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/'

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/'

, it runs flawlessly every time.

3 Comments on ps Display Width in OS X

  1. Unbelievable!

    I’ve had this exact same issue pop up, most recently this week, when I was out of town and remotely connected to my Mac to see if I left Mail running. According to the output of ps -aux, I wasn’t. When I got home, and widened the window, sure enough, it was running!

    Amazing timing of your note. Thanks!


Leave a Reply

Social Widgets powered by

Advertisment ad adsense adlogger