2 Replies Latest reply on Nov 5, 2010 8:47 AM by 775132

    Long (extended?) display output of 'ps' command

      Hi, all

      If the path of a command is long, the output is being cut of from the output of 'ps -ef' command. On HPUX, there is a 'x' option from ps for extended display format to fix the problem. From the man page of 'ps' of Solaris, I don't see similar option exist. Does anyone know similar option exist for Solaris? Thanks.
        • 1. Re: Long (extended?) display output of 'ps' command
          IIRC this is due to the fact that the /usr/bin/ps uses a kernel struct which isn't large enough to contain the exact command line. IIRC this is because its significantly faster and displays output which is normally sufficient.

          The two ways i can think of on top of my head is to either run /usr/ucb/ps -auxwww, since this BSD compatible version uses a different struct and shows the entire argument.

          If you only want the command line of a few processes you can also use 'pargs'.

          • 2. Re: Long (extended?) display output of 'ps' command
            Using '/usr/ucb/ps auxw' prints a wider output, truncated to a maximum of 132 characters.

            Using '/usr/ucb/ps auxww' prints the full command-line arguments with no truncation (something that /usr/bin/ps cannot do). This is fetched, if permissions allow, from /proc/<pid>/as.

            If the values in the columns are large enough they can collide. For example:

            $ /usr/ucb/ps aux
            user1 3132 5.2 4.33132422084 pts/4 S Feb 16 132:26 Xvnc :1 -desktop X
            user1 3153 1.2 2.93544414648 ? R Feb 16 21:45 gnome-terminal --s
            user1 16865 1.0 10.87992055464 pts/18 S Mar 02 42:46 /usr/sfw/bin/../li
            user1 3145 0.9 1.422216 7240 ? S Feb 16 17:37 metacity --sm-save
            user1 3143 0.5 0.3 7988 1568 ? S Feb 16 12:09 gnome-smproxy --sm
            user1 3159 0.4 1.425064 6996 ? S Feb 16 11:01 /usr/lib/wnck-appl

            This can make both reading and postprocessing the values quite difficult.