How do you extend the output of ps -fe in Solaris so that it displays more than 80 characters? My process has several arguments and the process name could not be displayed anymore.
6 Answers
You can't display them with the default ps (/usr/bin/ps) which is a SVR4 regular one.
To get the full argument line, use the BSD ps (UCB = University of California at Berkeley):
/usr/ucb/ps -alxwww

- 29,783
- 6
- 61
- 72
-
1Nitpick: no `../bin/..`, just `/usr/ucb/ps` (Solaris 10). – Volker Stolz Apr 08 '11 at 14:18
-
Great, I prefer to make option -aluxwww though. – jasonline Apr 13 '11 at 02:48
-
1This still cuts off the output although it makes it wider than 80 characters. – Kevin Panko Feb 03 '15 at 16:08
-
Incidentally, on modern solaris (e.g. 2.10) it seems you aren't allowed to use the usr/ucb/ps to get the full command line of another user's processes by default. This sort of makes sense because to get the full command line, /usr/usb/ps has to go fishing in the memory space of the other user's process. That ps worked this way traditionally and was trusted to do so is neither here nor there. To boot, /usr/ucb/ps is not installed by default on the most current version (grr) so you're left with the 'pargs' utility, which has similar access limitations. – jrodman Apr 06 '15 at 04:20
We have finally fixed this in Solaris; as of Solaris 11.3 SRU 5, all original argument vectors as well as the environment variables can be retrieved from /proc. ps will now print all of the command line.

- 56
- 1
-
1Perhaps it's worth noting that this displays the original launch arguments, not the current in-memory version of the arglist. That's reasonable but deviates from Linux. – jrodman Apr 28 '18 at 02:44
The simple answer is that there is no way to reliably acquire the full arguments to processes on Solaris for processes owned by other users. If you have root or other privileged access you can use /usr/ucb/ps on older versions, and 'pargs' or similar tools on newer versions (there is no tool which works across all versions).
Essentially Solaris stores the original args at process start time, while most other platforms allow ps to access, via some means, the contents of argv at runtime for the process. This stored-copy is in a special kernel data structure with limited (80 byte) size. This also means that it's not possible for a program to modify the args post-start as displayed by ps for useful or nefarious means.
Thus, if you need to access the command line for portable purposes, such as pid checking, you will need to choose between enforcing a short command line via hacks like launching programs controlled execp paths without absolute paths, or you will need to forgo that portable functionality on Solaris.

- 91
- 6
-
In Solaris, from 2005 onwards you can use the `pargs` command to get the full command line. Yes, true, it will not work on very old versions of Solaris, but if you really have something running on < v10 you've probably deliberately left that env to die anyways. – peterh Apr 06 '15 at 09:05
-
Like it or not, I have customers on Solaris 9. This sort of thing is only going to increase as VMs become more popular, whether or not I agree with it. – jrodman Apr 07 '15 at 05:06
-
pargs doesn't actually solve the problem. It only works for your own processes, not those owned by others. – jrodman Feb 04 '16 at 18:03
There are two sets of options available for ps. Others will chime in with the correct names ( ( maybe BSD and SRVn)?)
With the non-options-preceded-with-a-hyphen-version, you can do
ps auxww(w?) | grep ${PID}
to extend the length of the command detail that is printed (again, notice NO leading '-' option indicator).
Note that in some cases you will see a lot of environment variable assignments before the actually command, i.e. myPath=... cfgFile=... /path/to/command ... args ...
I think that 'www' in some systems will print everything, regardless how long the command is.
Finally, in my experience using ps to do a lot of crazy things, I would ocassionally have a PID and the output would display the first 6? columns, but the space reserved for the command was empty or had some sort of place holder value. I eventually found out why that was true, by searching comp.unix.shell, but it's too long ago now to be sure and I don't have access to Solaris systems right now.
I hope this helps.

- 36,525
- 7
- 83
- 90
Try ps -efl
. If that doesn't work (I don't have a Solaris box handy) you can also try ps -efl | cat
(as some programs check whether they're outputting to a terminal to decide on their output width).

- 102,968
- 15
- 177
- 252