首页 > 系统相关 >android开发adb shell ps无法列出进程列表的解决方法

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

时间:2022-12-12 19:00:23浏览次数:42  
标签:ps shell -- PID adb 进程

问题:

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就是搜索的意思

标签:ps,shell,--,PID,adb,进程
From: https://www.cnblogs.com/yongfengnice/p/16976880.html

相关文章