1823374 Members
2480 Online
109654 Solutions
New Discussion юеВ

ps command

 
Jasmin Berube
Advisor

ps command

It seem that the ps command truncate its output to a certain quantity of caracters.
I would like to find a way to get all the output form ps especialy the "args" field. (the command line given when the process was created) Is there a way to do this?
14 REPLIES 14
James R. Ferguson
Acclaimed Contributor

Re: ps command

Hi:

I thing you are stuck with what you get. Only a subset of the command line is saved by the kernel.

...JRF...
John Palmer
Honored Contributor

Re: ps command

The man page for ps states:-

args
The command line given when the process was
created. This column should be the last one
specified, if it is desired. Only a subset of the command line is saved by the kernel; as much of the command line will be displayed as is available.

So I guess that if the kernel doesn't keep it all then there's no way that you can retrieve it.

Jasmin Berube
Advisor

Re: ps command

ok and if so, is it a kernel configurable parameter?
Jasmin Berube
Advisor

Re: ps command

oh sorry... i misunderstood the answer... forget about the last question....
John Palmer
Honored Contributor

Re: ps command

Not that I am aware of. What are you trying to achieve? There may be an alternative approach.
James R. Ferguson
Acclaimed Contributor

Re: ps command

Hi:

This is not configurable to my knowledge. For configurable parameter documentation see:

http://docs.hp.com/hpux/content/KCparams.OverviewAll.html

...JRF...
Jasmin Berube
Advisor

Re: ps command

I'm trying to get the complete command line generated by a script.
Jim Welch
Respected Contributor

Re: ps command

If that's all you want, I would write the generated command line out to a log file just prior to executing it (or instead of executing it).
Any sufficiently advanced technology is indistinguishable from Magic - Arthur C. Clarke
John_Hancock
Trusted Contributor

Re: ps command

The previous answers were correct. Only 40 characters of the command line are preserved. If the command is less than 40 characters long you can pull it out of the ps -ef command. Otherwise you will have to devise another way.
John
Andy Monks
Honored Contributor

Re: ps command

The limit is 64 characters, not 40. Also, if they are typing the commands in, you could always look in the shell history files.

Re: ps command

You may be partially stuck, however, you can get more info by setting the UNIX95= environment varialble. You can the issue the ps -eo ruse,vsz,pid,args command and then perhaps pipe the output to the sort -rn -k2 command. This will allow you to see more of the command being executed. You could also use a cd to change directories to the command that you want to execute and then issue the specified command with the ./command arg... syntax.

Hope this helps!
Roger G. Vincent

Re: ps command

You may be partially stuck, however, you can get more info by setting the UNIX95= environment varialble. You can the issue the ps -eo ruse,vsz,pid,args command and then perhaps pipe the output to the sort -rn -k2 command. This will allow you to see more of the command being executed. You could also use a cd to change directories to the command that you want to execute and then issue the specified command with the ./command arg... syntax.

Hope this helps!
Roger G. Vincent

Re: ps command

You may be partially stuck, however, you can get more info by setting the UNIX95= environment varialble. You can the issue the ps -eo ruse,vsz,pid,args command and then perhaps pipe the output to the sort -rn -k2 command. This will allow you to see more of the command being executed. You could also use a cd to change directories to the command that you want to execute and then issue the specified command with the ./command arg... syntax.

Hope this helps!
Roger G. Vincent

Re: ps command

Set the environment variable UNIX95=. Then issue the ps -eo ruser,vsz,pid,args command. This will list more of the args command. You can also cd to the directory where the command is located and then invoke ./command arg...

Have Fun.
Roger G. Vincent