3

In solaris, /usr/ucb/ps auxww gives full commandline arguments (without truncating long commands+arguments).

And ps has -o option that provides formatted output.

Is there a single command (or one-liner) that has both capabilities?

Note: the issue also has to do with ps truncating arguments after a specific width hence the need for /usr/ucb/ps.

2
  • Not sure about solaris, but in my experience lots of ps's truncate if stdout is a tty. Try piping the output like ps whatever |cat. Jun 21, 2015 at 12:01
  • That doesn't work. Tested it.
    – user55570
    Jun 21, 2015 at 12:12

2 Answers 2

4

Not with a single command that I'm aware of.

Solaris ps gets process data for such things as command-line arguments from the /proc/[PID]/psinfo file, which contains data that fills a struct psinfo per /usr/include/sys/procfs.h:

#define PRARGSZ     80  /* number of chars of arguments */
typedef struct psinfo {
    int pr_flag;    /* process flags (DEPRECATED; do not use) */
    int pr_nlwp;    /* number of active lwps in the process */
    .
    .
    .
    char    pr_fname[PRFNSZ];   /* name of execed file */
    char    pr_psargs[PRARGSZ]; /* initial characters of arg list */
...

So you can't get the entire set of command line arguments from /usr/bin/ps. You could use /usr/ucb/ps ... as you've already noted and format your output using awk or similar. There's also pargs, which can be used to emit command-line arguments. (The installed location of pargs varies depending on Solaris version.)

Be aware, though, that a process can modify its arguments, and to get the full argument information requires permission to read the process address space.

1

I think you can use ps -eo args if you want to see the every arguments

Anyway you can combine the first example with more options

ps -eo user,pid,args
4
  • ps truncates args after a specific width, and hence unable to display full command line arguments in all cases.
    – user55570
    Jun 21, 2015 at 11:32
  • I don't have this problem in linux.
    – c4f4t0r
    Jun 21, 2015 at 12:08
  • @c4f4t0r This isn't Linux. Jun 21, 2015 at 14:14
  • @AndrewHenle yes I know, I wrote that to say, that is a solaris problem.
    – c4f4t0r
    Jun 21, 2015 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .