adb: Find PID from the adb shell

前端 未结 4 629
自闭症患者
自闭症患者 2020-12-20 20:22

I am trying to get the PID of the process INSIDE adb shell. So, I am doing adb shell which gets me to the android shell. Now, if I were to get the PID using a regular shell

4条回答
  •  攒了一身酷
    2020-12-20 21:04

    Android versions starting with 6.0 already include pidof utility:

    usage: pidof [-s] [-o omitpid[,omitpid...]] [NAME]...
    
    Print the PIDs of all processes with the given names.
    
    -s      single shot, only return one pid.
    -o      omit PID(s)
    

提交回复
热议问题