adb常用命令介绍

adb connect

命令格式:adb connect <host>[:<port>]
作用:connect to a device via TCP/IP,Port 5555 is used by default if no port number is specified.
通过TCP/IP连接到远程设备
例子:连接到IP为192.168.2.99的设备
adb connect 192.168.2.99

adb disconnect

命令格式:adb disconnect [<host>[:<port>]]
作用:disconnect from a TCP/IP device,断开设备连接
例子:与IP为192.168.2.99的设备断开连接
adb disconnect 192.168.2.99

adb devices

命令格式:adb devices
作用:list all connected devices,列出当前已连接的设备。

adb pull

命令格式:adb pull <remote> [<local>]
作用:copy file/dir from device,从设备复制文件或目录到本地服务器或电脑 
例子:将设备上/storage/ScreenRecorder/video.mp4文件复制到本地服务器的/home/roger/tmp/video.mp4 
adb pull /storage/ScreenRecorder/video.mp4 /home/roger/tmp/video.mp4

adb push

命令格式:adb push <local> <remote>
作用:copy file/dir to device,从本地复制文件或目录到设备
例子:adb push /home/roger/tmp/video.mp4 /storage/ScreenRecorder/video.mp4

注:adb pull/adb push复制过程中可以更改文件或目录名字

adb shell

作用:run remote shell interactively,运行远程shell交互
注:在shell环境下可以指向linux的文件管理命令,进行文件的删除、复制、移动等操作。

adb shell <command>

作用:运行远程shell指令

adb shell rm filename

作用:删除设备上的文件或目录
例子:删除/storage/emulated/0/ScreenRecorder/tt.mp4
adb shell rm /storage/emulated/0/ScreenRecorder/tt.mp4

adb install

命令格式:adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
作用:push this package file to the device and install it,安装指定apk到设备
例子:安装ScreenRecorder.apk到设备

adb install ScreenRecorder.apk

注:切换到ScreenRecorder.apk所在目录执行

adb uninstall

命令格式:adb uninstall [-k] <package>
作用:remove this app package from the device,卸载指定包名的app
例子:将包名为com.roger.screenrecorder的app卸载

adb uninstall com.roger.screenrecorder



你可能感兴趣的:(adb常用命令介绍)