I named this file psg
and put it in a place where my PATH
could find it. You could do that, too. Also, you'll want it to be executable: chmod +x /path/to/psg
.
Created
February 21, 2012 05:20
-
-
Save benhamill/1873929 to your computer and use it in GitHub Desktop.
List processes that match a string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $1 ]]; then | |
echo -e "Usage: psg pattern\n\nShow processes whose name matches the pattern." | |
else | |
pid_list=$(pgrep -d, $1) | |
if [[ -n $pid_list ]]; then | |
ps up ${pid_list} | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment