I am trying to capture process name which are using high memory on my box. I ran below command to get that

while [ 1 ]
   ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
   sleep 5

But the issue it is not giving me the full cmd details which is running against the PID. Output I am getting is like this :

PID  PPID CMD                            %MEM     %CPU
916 915 /usr/bin/perl /release/data/ 11.9  0.2
831 830 /usr/bin/perl -w /release/da  6.5  0.0
608 607 /etc/alternatives/java_sdk_  2.4  1.2
135 134 /etc/alternatives/java_sdk_  1.4  1.6

I want to capture the full cmd of the PID.

2 Answers 2


I assume by "full cmd details" you mean including the arg list? If so, try this this below. It will give you up to 100 char wide for the CMD column. You can adjust as needed.

ps -eo pid,ppid,cmd:100,%mem,%cpu --sort=-%mem | head

You can always use the top command with switches to manipulate the output:

top -b -c -n 1 -o +%MEM | sed -n '7,17p'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .