For When You Can't Have The Real Thing
[ start | index | login ]
start > ps tricks

ps tricks

Created by dave. Last edited by dave, 14 years and 140 days ago. Viewed 1,762 times. #5
[diff] [history] [edit] [rdf]
labels
attachments

Tricks with ps

Process time and excluding particular users:

$ ps -eo pid,cputime,user,args | egrep -v 'root|daemon|smmsp|ntp'
ParameterDescriptionComment
pidprocess id 
cputimeaccumulated CPU timehh:mm:ss
userwho owns the process 
argscommand + argumentslong invocations get truncated

An easy way to get ps to tell you what the size of a target process:

$ ps -eo pid,size,rss,vsz,pmem,args | grep process
ParameterDescriptionComment
sizememory sizein kilobytes
rssResident Set Size 
vsztotal VM sizein bytes
pmempercentage memory usenot really useful unless you are chasing a low memory situation

When piping ps output, sometimes it gets truncated (for example, when we grep). To avoid:

$ ps -ef --columns=999
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt