android开发adb shell ps无法列出进程列表的解决方法

问题:

C:\WINDOWS\System32>adb shell ps
USER            PID   PPID     VSZ    RSS WCHAN            ADDR S NAME
shell         16817   2271 2133456   3336 0                   0 R ps

发现并没有列出手机app的进程列表呀

解决方法:

使用C:\WINDOWS\System32>adb shell ps --help   #添加--help就可以查看需要添加的参数
显示帮助如下:
Which processes to show (-gGuUpPt selections may be comma separated lists):
-A  All#显示全部                                 -a  Has terminal not session leader
-d  All but session leaders             -e  Synonym for -A
-g  In GROUPs                           -G  In real GROUPs (before sgid)
-p  PIDs (--pid)                        -P  Parent PIDs (--ppid)
-s  In session IDs                      -t  Attached to selected TTYs
-T  Show threads also                   -u  Owned by selected USERs
-U  Real USERs (before suid)
Output modifiers:

-k  Sort FIELDs (-FIELD to reverse)     -M  Measure/pad future field widths
-n  Show numeric USER and GROUP         -w  Wide output (don't truncate fields)

Which FIELDs to show. (-o HELP for list, default = -o PID,TTY,TIME,CMD)

-f  Full listing (-o USER:12=UID,PID,PPID,C,STIME,TTY,TIME,ARGS=CMD)
-l  Long listing (-o F,S,UID,PID,PPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD)
-o  Output FIELDs instead of defaults, each with optional :size and =title
-O  Add FIELDS to defaults
-Z  Include LABEL
所以使用adb shell ps -A 即可显示所有进程,adb shell ps -Af 即可显示所有进程的所有信息了
列出自己需要的进程信息可以可以结合grep命令:adb shell "ps -Af | grep com.suyf.demo"  #com.suyf.demo是自己app的包名获取其他关键字也可以,grep就是搜索的意思
posted @   yongfengnice  阅读(359)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示