1827775 Members
2586 Online
109969 Solutions
New Discussion

ps command

 
SOLVED
Go to solution
wilson zhao
Occasional Contributor

ps command

Hi

Anybody knows if ps command can show
percentage of CPU used by a process, how?

thanks,
Wilson
7 REPLIES 7
MANOJ SRIVASTAVA
Honored Contributor

Re: ps command

Hi Wilson


May be try the -l options ( man ps ) but then the better way to find the cpu usage is to use may be top or glance.


Manoj Srivastava
John Carr_2
Honored Contributor

Re: ps command

Hi

the ps command has lots of columns it can display including Percentage of CPU time used by process The column header is %CPU and the option to use is pcpu

ps -flPpcpu

John.
Tom Danzig
Honored Contributor

Re: ps command

Use the -l switch to ps (i.e. ps -elf). It will give a rough idea of CPU utilized in the column labeled "C"

The man page specifies this as "Processor utilization for scheduling"
PIYUSH D. PATEL
Honored Contributor

Re: ps command

Hi,

Use glance or top and from there you can find out easily.

You can even find out which processes are using the CPU and for how much time.


Piyush
Sanjay_6
Honored Contributor
Solution

Re: ps command

Hi Wilson,

Use top to see the process cpu usage.

You can also use ps like this,

export UNIX95=XPG4
ps -o pcpu

Hope this helps.

Regds
steven Burgess_2
Honored Contributor

Re: ps command

Hi

Have a look at the following documentation regarding using the ps command and manipulating processes that are hung - will give you a further insight.

Regards

Steve
take your time and think things through
Uday_S_Ankolekar
Honored Contributor

Re: ps command

Hello

Try using UNIX95 option within ps. The following command would give you the list of top ten cpu consumed process
Pleas note that there is space after equalto sign
UNIX95= ps -e -o "pcpu vsz ruser pid stime time state args" | sort -rn |head -10

Goodluck,
-USA..
Good Luck..