Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'fancy': 0.16; 'processes.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:most': 0.16; 'wrote:': 0.16; 'script.': 0.18; 'parameter': 0.22; 'wrote': 0.23; 'header :In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'linux': 0.26; 'checking': 0.27; 'fine': 0.28; 'that.': 0.30; 'are:': 0.32; 'expensive': 0.32; 'getting': 0.33; 'useful': 0.33; 'skip:- 10': 0.34; 'this?': 0.34; 'worked': 0.34; 'done': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'here.': 0.62; 'charset:windows-1252': 0.62; 'received:12': 0.81; 'subject:get': 0.81; 'cecil': 0.84; 'westerhof': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Linux script to get most expensive processes Date: Tue, 4 Aug 2015 13:52:39 -0700 References: <87twsehkmk.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: www.westernstatesglass.com User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <87twsehkmk.fsf@Equus.decebal.nl> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1438721578 news.xs4all.nl 2955 [2001:888:2000:d::a6]:54431 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94976 On 8/4/2015 1:19 PM, Cecil Westerhof wrote: > Under Linux I like to get the most expensive processes. The two most > useful commands are: > ps -eo pid,user,pcpu,args --sort=-pcpu > and: > ps -eo pid,user,pcpu,args --sort=-vsize > > In my case I am only interested in the seven most expensive processes. > For this I wrote the following script. > Is this a reasonable way to do this? Getting the parameter is done > quit simple, but I did not think fancy was necessary here. My platform shows as linux2 and it worked fine for me when checking for that. Emile