try...
/usr/ucb/ps -w
Or...
/usr/ucb/ps -www
(ie: Wide Wide Wide)
abv-sfo1-x-app58:~> /usr/bin/ps -p 5136
PID TTY TIME CMD
5136 pts/32 0:33 java
abv-sfo1-x-app58:~> /usr/ucb/ps 5136
PID TT S TIME COMMAND
5136 pts/32 S 0:33 /usr/local/depot/j2sdk-1.3.1_01/usr/j2se/bin/.
+./bin/spa
abv-sfo1-x-app58:~> /usr/ucb/ps -w 5136
PID TT S TIME COMMAND
5136 pts/32 S 0:33 /usr/local/depot/j2sdk-1.3.1_01/usr/j2se/bin/.
+./bin/sparc/native_threads/java -server -native -ms64m -mx64
abv-sfo1-x-app58:~> /usr/ucb/ps -www 5136
PID TT S TIME COMMAND
5136 pts/32 S 0:33 /usr/local/depot/j2sdk-1.3.1_01/usr/j2se/bin/.
+./bin/sparc/native_threads/java -server -native -ms64m -mx64m -classp
+ath ./lib/weblogic510sp10boot.jar:./classes/boot -Dfile.encoding=iso-
+8859-1 -Dweblogic.class.path=./lib/weblogic510sp10.jar:./license:./cl
+asses:./lib/weblogicaux.jar:./server-7022/serverclasses:./server-7022
+/lib/activation.jar:./server-7022/lib/avs30.jar:./server-7022/lib/cos
+.jar:./server-7022/lib/jakarta-oro-2.0.2-dev-2.jar:./server-7022/lib/
+jakarta-regexp-1.0.jar:./server-7022/lib/jconn2.jar:./server-7022/lib
+/mail.jar -Dweblogic.home=. -Djava.security.manager -Djava.security.p
+olicy==/var/httpd/weblogic-5.1.0/weblogic.policy -Dweblogic.system.na
+me=server-7022 weblogic.Server
| [reply] [d/l] |
Thank you, that was exactly the advise I needed !
Beeing curious, I wonder if you know why /usr/ucb/ps prints the full commandline, but when redirecting its output, the
-www switch is needed ?
thanks,
Kurt
| [reply] |
(first of all, i realize now that -ww is usually all you need -- i can't remember why, but some where i got it in my head that on some systems, you need -www)
I don't have any documentation to back this up, but as i
understand it, this is what happens:
-
If /usr/ucb/ps has no idea where it's output is going
(ie: you are redirecting it, or on a dumb terminal) then it follows the strict
definition in the manpage: 80 chars, unless you use -w in
which case it's 132 chars, unless you use -ww(w) in which case
it's as wide as possible.
- If you are using a non-dumb terminal, and /usr/ucb/ps
can determine your terminal width, then it will use that
width by default. if you use -w (or -ww or -www) it will output as much as possible
you probably aren't really seeing -w truncated to 80 characters when you pipe it -- you're probably seeing it truncated to 132, which is all -w is documented to give you.
| [reply] |
| [reply] |
If you're interested in the gory details, check out the proc(4) man page ("man -s4 proc"), specifically the psinfo and as files. psinfo contains two things to help you:
- The first 80 characters of the original command line, basically, the string that /usr/bin/ps prints.
- The address of the process's original argument list, within its address space. By opening the as file and seeking to this address, you can read the arg list out of the process's address space.
In principle, you could use perl to do either of these things. Hopefully you're familiar with pack and unpack.
| [reply] |