Is there a way to generate a full process listing in solaris, without truncated lines? I’ve tried the ps command, with the following arguments:
-f Generates a full listing. (See below for
significance of columns in a full list-
ing.)
-l Generates a long listing. (See below.)
So, those both seem to do what I want, however, further down in the ps man page, I find this:
args The command with all its arguments as a
string. The implementation may truncate
this value to the field width; it is
implementation-dependent whether any
further truncation occurs. It is
unspecified whether the string
represented is a version of the argument
list as it was passed to the command
when it started, or is a version of the
arguments as they may have been modified
by the application. Applications cannot
depend on being able to modify their
argument list and having that modifica-
tion be reflected in the output of ps.
The Solaris implementation limits the
string to 80 bytes; the string is the
version of the argument list as it was
passed to the command when it started.
Which basically says the output is going to be truncated and there is nothing I can do about it. So, I’m coming here. Surely other people have run into this problem and maybe even have a way around it. I’m guessing ps can’t do it and so I need to use other tools to do this. Is that accurate?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
you could try
pargs <PID>
this gives you a list of all arguments
or else use an other ps. If run as root (or any user with enough privileges for that matter)
/usr/ucb/ps auxww
will give you all arguments. Its part of SUNWscpu, “Source Compatibility, (Usr)”
Method 2
The kernel is not required to keep track of command line arguments. When a program is started through the execve call, the kernel must copy the arguments into the process memory (so that they will be available as argv in a C program, for example). After that, the kernel can discard the memory used to store the initial command line arguments. The process is allowed to overwrite its copy of the arguments. So there may simply be no trace of the arguments.
Some unix variants do keep a copy of the arguments in some form. Solaris exposes some data in /proc/$pid. As of OpenSolaris 2009.06, the only trace of the arguments is in /proc/$pid/psinfo, where they are concatenated with spaces in between (so you can’t distinguish between foo "one" "two" and foo "one two") and the resulting string is truncated to 80 bytes. This field in /proc/$pid/psinfo is what ps prints in the args column.
By the way, the -f and -l options control what fields are printed, not whether the fields are truncated to some width.
Method 3
ps -e gives the list of all the processes running. Also there’s this ps -elf.
Method 4
prstat will give you the currently running processes along with their pids and the CPU utilization.
Method 5
Depending which ps command you use, I use
ps -auxw
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0