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.

user55570
  • 320

2 Answers2

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.

Andrew Henle
  • 3,780
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
c4f4t0r
  • 649