adb shell ps和adb shell ps -A获取进程状态的区别
背景: android 8 以上的手机偶现adb shel ps获取不到想要进程信息(mt和zm遇到的问题)
ps
USER PID PPID VSZ RSS WCHAN ADDR S NAME
root 4285 1516 4632 1544 sigsuspend add6067c S sh
root 5421 4285 5628 1560 0 a93e53b4 R ps
根因:ps指向文件从android8.0版本开始,由toolbox变成toybox,通过ps --help可以看到,查看所有进程命令已经修改为ps -A
-A All processes
-a Processes with terminals that aren't session leaders
-d All processes that aren't session leaders
-e Same as -A
-g Belonging to GROUPs
-G Belonging to real GROUPs (before sgid)
-p PIDs (--pid)
-P Parent PIDs (--ppid)
-s In session IDs
-t Attached to selected TTYs
-T Show threads
-u Owned by USERs
-U Owned by real USERs (before suid)
Output modifiers:
-k Sort FIELDs in +increasing or -decreasting