Gentoo Archives: gentoo-user

From: Paul Hartman <paul.hartman+gentoo@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Filter grep output of 'ps aux'
Date: Fri, 02 Mar 2012 20:52:27
Message-Id: CAEH5T2PF0cU_pAGLmPf16qWiYGJ9++WtcwegkwARuSXRZo--+A@mail.gmail.com
In Reply to: Re: [gentoo-user] Filter grep output of 'ps aux' by Tanstaafl
1 On Fri, Mar 2, 2012 at 2:39 PM, Tanstaafl <tanstaafl@×××××××××××.org> wrote:
2 > On 2012-03-02 2:33 PM, Paul Hartman <paul.hartman+gentoo@×××××.com> wrote:
3 >>
4 >> And you can use the --sort options for ps to sort by cpu or anything
5 >> you like (see the manpage)
6 >
7 >
8 > Even better, thanks Paul...
9 >
10 > watch -n1 "ps aux --sort=-%cpu | gawk '{ if ( \$3 > 1.0 ) { print } }'"
11 >
12 > does exactly what I want...
13 >
14 > Hmmm... is there an easy way to include the column headers?
15
16 To build on Grant's suggestion:
17 ps aux --sort %cpu | gawk 'NR==1; $3 > 0'

Replies

Subject Author
Re: [gentoo-user] Filter grep output of 'ps aux' Tanstaafl <tanstaafl@×××××××××××.org>