Skip to content
Browse files

Add ag-psgrep command

  • Loading branch information...
1 parent 9435076 commit b2e9e98e3d420d23c63b502267b0024d689c7809 @avdgaag committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 libexec/ag-psgrep
View
14 libexec/ag-psgrep
@@ -0,0 +1,14 @@
+#!/bin/sh
+# Usage: ag 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:
+#
+# ag psgrep 'ruby'
+#
+
+ps aux | awk '/'"$@"'/ && !/ag-psgrep/ { $1 = ""; for(i=3; i <= 10; i++) { $i = "" }; gsub(/^ +| +/, " ", $0); print $0 }'

0 comments on commit b2e9e98

Please sign in to comment.
Something went wrong with that request. Please try again.