ps aux with line wrap

File this under you learn something new every day.

Ever do a ps aux only to get something like this to happen?

xymon 26931 0.0 0.0 38944 1396 ? S 05:44 0:00 sh -c vmstat 300 2 1>/usr/lib64/xymon/client/tmp/hob

So the output of ps aux gets cut off when it hits the end of your terminal. And you have to expand your width a lot to see it. It always bothered me till I decided to read the man page.

Now I learned you can do

ps aux --width 1000

That will line wrap your output but cut the output at 1000 characters. You can also pass w’s into the command like

ps auxww

That will ignore your terminals width settings

So now we can add the following in our .bashrc or for system wide /etc/profile so we never have to remember to add a ww or –width again

alias ps='ps ww'

So that alias means you can type ps aux and it will be like your typed ps auxww

About mike
Currently works for OpenSky as a Senior Linux Admin. He has a wonderful wife Thanuja and 2 great dogs. His major side project is Photoblog.

Comments

2 Responses to “ps aux with line wrap”
  1. Eric says:

    hey mike great post

    i was looking to do this in osx, but i cannot seem to find the width switch in the man pages, i guess ps process is different. any other suggestions for accomplishing the above?

    • mike says:

      I don’t think os x has the –width option since it uses bsd ps. The linux one includes most of the open source ps flags all wrapped into one command. From the os x man page it just determine the length of your terminal. You can use the ww option though to have it ignore the width.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!