Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'See how long a given process has been running' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
See how long a given process has been running
Authored by: maevis on Nov 28, '12 05:20:13PM
Slightly more succinct:

psup() { ps acxo etime,command | grep -- "$1"; }

Now when no search pattern is supplied, grep will just match against an empty string and output the entire list instead of complaining about missing arguments.

The double dash ensures that search patterns beginning with a dash don't get mistaken for grep flags. This seems a good idea because login shells are prefixed with a dash, and this way commands like psup -bash will work as intended.



[ Reply to This | # ]
See how long a given process has been running
Authored by: stevebr on Nov 29, '12 11:29:48AM

Thanks. This is exactly what I was going for in my crude version above.



[ Reply to This | # ]