Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I look on man ps and unsertand that using with ww will give me the full command. However running :

ps ww axco command,pcpu

dosnt give full command name. I want the complete process name. the result is like this:

gnome-fallback-              0.0 39312

Any advice?

Running on Ubuntu

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The c following the ax is causing your problem. This causing the command output to be truncated to the 15 character comm.

c Show the true command name. This is derived from the name of the executable file, rather than from the argv value. Command arguments and any modifications to them (see setproctitle(3)) are thus not shown. This option effectively turns the args format keyword into the comm format keyword; it is useful with the -f format option and with the various BSD-style format options, which all normally display the command arguments. See the -f option, the format keyword args, and the format keyword comm


Update

I don't think you can do what you want directly with ps. It looks like ps displays either some portion of the command line or the first 15 characters of the command name depending on which options are set.

After that things get messy ...

 ps -eo command:400,pcpu |awk '{print $1,$NF}'| sed '/^\// s|/| |g' | awk '{print $(NF-1), $NF}'
  • Get the command line and pcpu from ps (hopefully 400 chars is sufficient)
  • Print the first and last fields /path/to/long-command-name-here 0.0
  • Remove all the / from lines beginning with /
  • Print the last 2 field of the result which should be the name and pcpu
share|improve this answer
    
I dont want the command argument . just want the process name –  Avihai Marchiano Sep 19 '12 at 8:39
    
@user1495181: I updated my answer. –  Iain Sep 19 '12 at 11:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.