Solaris ps output truncated at 80 columns

When running the ps command on Solaris, the output is truncated at 80 columns – really annoying when the command line to start up a process (typically a daemon) is really long. This has been annoying me for ages, and I finally found a (sort of) solution – use a different ps, and run as root:

# uname -a
SunOS fubar 5.9 Generic_118558-24 sun4u sparc SUNW,UltraAX-i2

# which ps
/usr/bin/ps

# /usr/ucb/ps auxwww 2> /dev/null | grep 22480
root     22480  0.0  0.1 1896 1232 ?        S 10:22:11  0:00 ptymonitor --oob-fd 49 --stderr-mode MUX
--pty --term screen --rows 47 --cols 177
--termios 38400:38400:3.1C.7F.15.4.FF.FF.11.13.1A.100.12.17.16.100.100.100.F:B40:E3B:544505:8
--ttlg --gid 0 --uid 0 --wait-time 60 bash --rcfile /home/fubar/deployment/bin/dotbashrc_install.sh

This can also be made to work for non-root users by granting the account the proc_owner privilege. For example, for the user fred:

/etc/security/prof_attr
Process Query:::Query Processes as Root:

/etc/security/exec_attr
Process Query:suser:cmd:::/usr/ucb/ps:privs=proc_owner;uid=0;euid=0;gid=0;egid=0

/etc/user_attr
fred::::type=normal;profiles=Process Query

passwd -e fred
/usr/bin/pfksh

cd ~fred
echo "export PS1='% '" >> .profile
Tags:


Share This


 


7 Responses to Solaris ps output truncated at 80 columns

  1. Very detailed steps. Excellent!

    It helped solve my problem.

  2. Hey Just wanted to say this definitely saved me from pulling my hair. Thanks for the explanation.

  3. […] found the answer on the following blog<br> <http://blog.snowfrog.net/2010/06/10/solaris-ps-output-truncated-at-80-columns/&gt; This entry was posted in Uncategorized by admin. Bookmark the […]

  4. The main reason for this issue is, kernel does not store more than 80 columns of ps process output for non root users. Remember there are 2 different ‘ps’ commands. One is /bin/ps and another /usr/ucb/ps.

    /usr/ucb/ps auxwwww

    This will give you complete output and will not truncate the ps output.
    If you use /bin/ps as non root user, you will end up getting your output truncated at 80 columns.

  5. Martin Přikryl

    Useful, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>