Get PID of a process in Android

Without root access:

ps | grep keywords | grep -v grep | head -1 | awk '{print $2}'

With rooted phone and busybox:

su -c busybox ps | grep keywords | grep -v grep | head -1 | awk '{print $1}'

Leave a comment

Your email address will not be published. Required fields are marked *