views:

270

answers:

3

Hi,

How do I get the full width result for the *nix command "ps"?
I know we can specify something like "--cols 1000" but is there anyway I can the columns and just print out everything?

+5  A: 

Try ps -w -w aux. The -w option sets the output to wide, and doing it twice makes the width unlimited. The "aux" part makes it show more information, and is (afaik) pretty standard mode to use. This is of course platform-dependant, the above works with procps version 3.2.7 on Linux.

unwind
There's nothing magical about "aux"; they're simply the 'a', 'u', and 'x' options specified together. So, you can merge the two 'w' options in too. :-)
Chris Jester-Young
Ah, yes, true of course. I guess it's just my standard incantation, to treat "aux" as an argument more than an option. Thanks, though.
unwind
+3  A: 

Specify the w option twice, if you're using BSD-style ps. e.g., ps auwwx. A different set of options apply when using System V ps.

Chris Jester-Young
This is a comment, not an answer, surely.
Max Howell
It's an answer now!
Chris Jester-Young
+2  A: 

There are two different option syntaxes for ps; the standard POSIX one based on SysV, and the BSD one. GNU ps, as used on linux, supports both, which it can do because the POSIX options have dashes in front and the BSD ones don't, as well as some of it's own options in the normal GNU --long-option-name style.

Anyway, to get all processes in POSIX style is -e, in BSD it's ax (a includes other user's processes, x includes processes without a controlling terminal i.e. daemons).

There is no single option that will make it include all the columns. There are a huge number of possible columns. The POSIX options -f, -F and -L all cause it to show different sets of extra columns, as does the BSD option u (hence the "ps aux" mentioned in another answer is a very common command).

If you really want more columns than that you have to name explicitly which ones you want, using the -o (or o) option. See the man page for a list. There's about a hundred different names you can use, but some of them are duplicates, and others display the same info in different ways.

Mark Baker
Accurate but answering the wrong question...
ephemient
I read the bit about "printing out everything" to mean they wanted all the possible columns in the output, so I answered that. I agree the bit about getting all processes was the wrong question.
Mark Baker