Librenix  
(Show all Scripting articles . . .
)  
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Scripting ps and grep

Up
vote
Down

A scripted approach to grepping what you want out of the ps command...
If you've worked in Unix for any length of time, you're probably familiar with psg or some such variant. Psg stands for "ps through grep" (essentially a ps query whose result is piped grep). It works and works well, but sometimes you need more than just a process string; sometimes you want the process string AND the process ID (PID) — separated. Oh yes, and since we're compiling a wish list here, how about the operation simply telling me how many processes match a given target string. I'll show how to do all of that — and do it without having to run multiple ps commands and filtering those results through several piped operations.
 read more | mail this link | score:8466 | -Ray, February 9, 2006
More Sysadmin articles...

Buy Fine Art on Canvas Online

admin headlines

Using ngx_pagespeed with nginx On Debian 7

Tutorial: Filesystem Encryption with EncFS (Debian 6/Ubuntu 11.10)

Running Mailman on Nginx on Debian 6/Ubuntu 11.10, 11.04

Openfiler 2.3 cluster with offsite replication

Tutorial: Install Nginx, PHP5, MySQL (Fedora 14)

Clean djbDNS DNS Server on CentOS: dnscache, tinydns

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin