Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 15 lines (13 sloc) 398 Bytes
#!/bin/sh
# Usage: a psgrep PATTERN
# Summary: Find running processes using grep
# Help: This is a tiny wrapper to search for a regex PATTERN
# in the output of `ps aux`, excluding the grep process itself.
#
# EXAMPLES
#
# Show all Ruby processes:
#
# a psgrep 'ruby'
#
ps aux | awk '/'"$@"'/ && !/a-psgrep/ { $1 = ""; for(i=3; i <= 10; i++) { $i = "" }; gsub(/^ +| +/, " ", $0); print $0 }'