Last active
October 14, 2015 02:17
-
-
Save yantonov/4291698 to your computer and use it in GitHub Desktop.
Get process id by name in linux.
This file contains 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 | |
# find process id by name | |
# returns pid | |
if [ $# -lt 1 ]; then | |
echo "Usage: pidbyname name" | |
exit 0 | |
else | |
EXEC_NAME=$1 | |
fi | |
ps -e | grep "bash" | awk -F\ '{print $1}' | |
# or use pgrep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment