When using the adb Monitor tool to read the Logcat, I like to filter out all everything but what directly affects the app. Trouble is, it's really hard to tell what the PID of your app. It easy enough if the app using Unity, but if it doesn't, It's almost impossible to use to tell.

So is there a ADB command that can tell what PID an app used?

2 Answers 2


Simply do:

adb.exe shell pidof com.packagename.example

If you want to ensure only one PID is shown try:

adb.exe shell pidof -s com.packagename.example
  • 1
    Worked perfectly on Android 9. Seems like an optimal answer.
    – user598527
    Commented Apr 20, 2020 at 12:06

You should be able to run a shell command from adb:

adb shell ps | grep your.app.name

And that will return details about your process. The second number will be the PID of your app. This is if grep is installed. If grep isn't installed, you can just run ps and it will dump all processes to your screen.

You can dump logcat to a file to retroactively look at processes (up to a point)
logcat > /sdcard/logcatDump.txt

However, logcat data is stored in memory so it will all be lost after a reboot.

  • I had the same thought in my mind and in fact wrote the answer until I realized that ps actually shows the PID of running processes. What OP asked here is the PID an app used. ps doesn't care for dead processes AFAIK.
    – Firelord
    Commented May 7, 2015 at 20:02
  • 1
    Ah, I missed that part. logcat is the only process that I know of that will have that data. It's stored in memory so you can't get it after a reboot. Question is modified to include that.
    – D. Gibbs
    Commented May 7, 2015 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .