Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIX small help with ps command

Status
Not open for further replies.

jodders

Programmer
Nov 12, 2003
13
0
0
GB
hey all,Im almost there and need help with something. I need to print out 10 processes in the system using the ps command.so far i have come up with:


–ps -e –o user, %cpu, %mem, cmd |sort –k 10

but i will list all of the processes on my SUSE Linux 8 system. I want the top 10 processes.Any suggestions?
 
Get it sorted according to whatever criteria you want, then pipe it to head.

So... to get the first 10 processes: with no sorting:

Code:
ps aux | head


Note that head by default displays the first 10 lines of its input. You can change this with its -n flag.
 
i want the 10 processes in highest percentages. so i think its in %mem
 
Do a reverse sort (-rn) on the desired column and pipe to head.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
thanks PHV is all sorted now.u da man
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top