当前位置:网站首页>Appium automation test foundation - ADB shell command
Appium automation test foundation - ADB shell command
2022-06-30 09:57:00 【Test - Eight Precepts】
Android The system is based on Linux Kernel , in other words Android The bottom layer of the system is Linux System . therefore Linux Many of the commands in Android There are the same or similar implementations in the system , stay adb shell You can call . The previous part has been used adb shell command , Let's add that yes adb shell Command awareness .
Tips : To be in Android On the phone adb shell command , You need to root mobile phone , Virtual machines are direct root Of Android System , So it can be used directly on the virtual machine adb shell command .
1、 Check the process
command :
adb shell psOutput example :
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 8904 788 ffffffff 00000000 S /init
root 2 0 0 0 ffffffff 00000000 S kthreadd
...
u0_a71 7779 5926 1538748 48896 ffffffff 00000000 S com.sohu.inputmethod.sogou:classic
u0_a58 7963 5926 1561916 59568 ffffffff 00000000 S org.mazhuang.boottimemeasure
...
shell 8750 217 10640 740 00000000 b6f28340 R psThe meaning of each column :
| Name | meaning |
|---|---|
| USER | Users |
| PID | process ID |
| PPID | The parent process ID |
| NAME | Process name |
2、 View real-time resource usage
command :
adb shell topOutput example :
User 0%, System 6%, IOW 0%, IRQ 0%
User 3 + Nice 0 + Sys 21 + Idle 280 + IOW 0 + IRQ 0 + SIRQ 3 = 307
PID PR CPU% S #THR VSS RSS PCY UID Name
8763 0 3% R 1 10640K 1064K fg shell top
131 0 3% S 1 0K 0K fg root dhd_dpc
6144 0 0% S 115 1682004K 115916K fg system system_server
132 0 0% S 1 0K 0K fg root dhd_rxf
1731 0 0% S 6 20288K 788K fg root /system/bin/mpdecision
217 0 0% S 6 18008K 356K fg shell /sbin/adbd
...
7779 2 0% S 19 1538748K 48896K bg u0_a71 com.sohu.inputmethod.sogou:classic
7963 0 0% S 18 1561916K 59568K fg u0_a58 org.mazhuang.boottimemeasure
...The meaning of each column :
| Name | meaning |
|---|---|
| PID | process ID |
| PR | priority |
| CPU% | The present moment takes up CPU percentage |
| S | Process status (R= function ,S= sleep ,T= track / stop it ,Z= Zombie process ) |
| #THR | Number of threads |
| VSS | Virtual Set Size Virtual memory consumption ( Contains the memory used by the shared library ) |
| RSS | Resident Set Size Actually using physical memory ( Contains the memory used by the shared library ) |
| PCY | Scheduling policy priority ,SP_BACKGROUND/SPFOREGROUND |
| UID | The user of the process owner ID |
| NAME | Process name |
top The command also supports some command line parameters , The detailed usage is as follows :
Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]
-m num Show at most how many processes
-n num Refresh how many times and exit
-d num Refresh interval ( Unit second , The default value is 5)
-s col Sort by a column ( You can use col value :cpu, vss, rss, thr)
-t Show thread information
-h Show help documents 3、 Check the process UID
There are two options :
adb shell dumpsys package <packagename> | grep userId=
Such as :
$ adb shell dumpsys package org.mazhuang.guanggoo | grep userId=
userId=103942、 adopt ps Command to find the pid after adb shell cat /proc/<pid>/status | grep Uid
Such as :
$ adb shell
gemini:/ $ ps | grep org.mazhuang.guanggoo
u0_a394 28635 770 1795812 78736 SyS_epoll_ 0000000000 S org.mazhuang.guanggoo
gemini:/ $ cat /proc/28635/status | grep Uid
Uid: 10394 10394 10394 10394
gemini:/ $4、 Other adb shell command
Here is a brief description of other common commands , The orders that have been specially mentioned above will not be explained additionally :
| command | function |
|---|---|
| cat | Display file contents |
| cd | Toggle directory |
| chmod | Change the access mode of files / Access right |
| df | View disk space usage |
| grep | Filter output |
| kill | Kill designated PID The process of |
| ls | List the contents of the catalog |
| mount | View and manage the mount Directory |
| mv | Move or rename files |
| ps | View running processes |
| rm | Delete file |
| top | Check the resource usage of the process |
and Linux The commands in the system are basically the same .
a key : Supporting learning materials and video teaching
So here I have carefully prepared the detailed information of the above outline in The link below is as follows


边栏推荐
猜你喜欢

【JVM】G1垃圾回收器简述

JVM tuning tool introduction and constant pool explanation
![[new book recommendation] cleaning data for effective data science](/img/42/1258694fc55a178a666391669a67ad.png)
[new book recommendation] cleaning data for effective data science

机械臂速成小指南(五):末端执行器

八大排序(一)

GPT (improving language understanding generative pre training) paper notes

Object detection yolov5 open source project debugging

MySQL优化

浏览器复制的网址粘贴到文档是超链接

单片机 MCU 固件打包脚本软件
随机推荐
工作小记: sendto失败 errno 22
正则表达式基础
oracle跨数据库复制数据表-dblink
Golang magic code
utils session&rpc
【JVM】G1垃圾回收器簡述
磁悬浮3D灯
Comparison problems encountered in recent study
How to reduce the delay in live broadcast in the development of live broadcast source code with goods?
Brève description du collecteur d'ordures G1
Redis docker 主从模式与哨兵sentinel
Cloud native database
input限制输入
Train an image classifier demo in pytorch [learning notes]
抽象类和接口
About Jul
MCU firmware packaging Script Software
Differences and relationships among hyper convergence, software defined storage (SDS), distributed storage and server San
3. integrate eslint and prettier
Upgrade log4j2 to 2.17.1 stepped pit