Skip to content

Instantly share code, notes, and snippets.

View kowntaq's full-sized avatar

kowntaq kowntaq

View GitHub Profile
@kowntaq
kowntaq / psgrep
Last active January 1, 2016 10:29 — forked from kiyop/psgrep
#!/bin/sh
case $# in
2) PTN="$2"; PS_OPTS="$1";;
1) PTN="$1";;
*) echo "Usage: `basename $0` [PS_OPTIONS] GREP_REGEX_PATTERN"; exit 1;;
esac
PS_RES=`ps $PS_OPTS | grep -v "sh $0"`
echo "$PS_RES" | head -n 1
echo "$PS_RES" | tail -n +2 | grep --color=auto -ie "$PTN"