Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Android phone. ADB is bundled with Android SDK package that can be downloaded from Android SDK download page. This tool is usefull for communicating with Android phone such as install application, copy files from/to device and perform some linux shell commands.

How to Install

Download and install Java SDK (Ex:jdk-6u20-windows-i586.exe)
Download Android SDK package (Ex:android-sdk_r06-windows.zip)
Extract SDK package into anywhere on your drive (Ex: D:\android-sdk-windows)
Phone Setup

In order to use ADB, you have to enable USB Debugging option in phone settings (Settings->Applications->Development)

How to Use

  • Connect the phone to your pc/notebook usb port
  • Run Windows command line tool (cmd) and go to D:\android-sdk-windows\tool

Update!!

New Android SDK puts adb executable file on \platform-tools directory instead of tool. So the path should be D:\android-sdk-windows\platform-tools

Usefull Commands

1. Check connected phone

Syntax: adb devices

2. Login to Android shell

Syntax: adb shell

Note:

If you get ‘#’ after typing adb shell, you are already get root access on the phone, no need to type su. Otherwise if you get ‘$’ , type ‘su’ to get root access (only for rooted device).

3. Some usefull shell commands

  • ls
    List directory

Syntax: ls [path]

Example:

#ls /system/lib

  • cp
    Copy file or directory

Syntax: cp [options] source dest

Note:

To copy or delete files in Android root directories you have to change the directory access mode to ‘read and write (rw)’ using command: remount rw

Example:

#remount rw

#cp /sdcard/libsec-ril.so /system/lib

#remount ro

  • mv
    Move file or directory

Syntax: mv [options] source dest

Example:

#mv /system/lib/libsec-ril.so /sdcard/backup

  • chmod
    Change file/directory permission

Syntax: chmod [-R] mode[,mode] …. file

Example:

#chmod 0644 /system/lib/libsec-ril.so

  • rm
    Remove file or directory

Syntax: rm [options] file

Example:

#rm /system/lib/libsec-ril.so

4. Install application

You can use adb to install aplication from your local drive into phone.

Syntax: adb install appname.apk

Example:

D:\android-sdk-windows\tools\adb install D:\AnReboot.apk

5. Copy files from phone to local drive

Syntax: adb pull source [destination]

Example:

D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip

D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip D:\

6. Copy files from local drive to phone

Syntax: adb push source destination

Example:

D:\android-sdk-windows\tools\adb push D:\AnReboot.apk /sdcard

To See The Original Link Please Click Here


  1. 获取序列号:

    adb get-serialno

  2. 查看连接计算机的设备:

    adb devices

  3. 重启机器:

    adb reboot

  4. 重启到bootloader,即刷机模式:

    adb reboot bootloader

  5. 重启到recovery,即恢复模式:

    adb reboot recovery

  6. 查看log:

    adb logcat

  7. 终止adb服务进程:

    adb kill-server

  8. 重启adb服务进程:

    adb start-server

  9. 获取机器MAC地址:

    adb shell cat /sys/class/net/wlan0/address

  10. 获取CPU序列号:

    adb shell cat /proc/cpuinfo

  11. 安装APK:

    adb install //比如:adb install baidu.apk

  12. 保留数据和缓存文件,重新安装apk:

    adb install -r //比如:adb install -r baidu.apk

  13. 安装apk到sd卡:

    adb install -s // 比如:adb install -s baidu.apk

  14. 卸载APK:

    adb uninstall //比如:adb uninstall com.baidu.search

  15. 卸载app但保留数据和缓存文件:

    adb uninstall -k //比如:adb uninstall -k com.baidu.search

  16. 启动应用:

    adb shell am start -n /.

  17. 查看设备cpu和内存占用情况:

    adb shell top

  18. 查看占用内存前6的app:

    adb shell top -m 6

  19. 刷新一次内存信息,然后返回:

    adb shell top -n 1

  20. 查询各进程内存使用情况:

    adb shell procrank

  21. 杀死一个进程:

    adb shell kill [pid]

  22. 查看进程列表:

    adb shell ps

  23. 查看指定进程状态:

    adb shell ps -x [PID]

  24. 查看后台services信息:

    adb shell service list

  25. 查看当前内存占用:

    adb shell cat /proc/meminfo

  26. 查看IO内存分区:

    adb shell cat /proc/iomem

  27. 将system分区重新挂载为可读写分区:

    adb remount

  28. 从本地复制文件到设备:

    adb push

  29. 从设备复制文件到本地:

    adb pull

  30. 列出目录下的文件和文件夹,等同于dos中的dir命令:

    adb shell ls

  31. 进入文件夹,等同于dos中的cd 命令:

    adb shell cd

  32. 重命名文件:

    adb shell rename path/oldfilename path/newfilename

  33. 删除system/avi.apk:

    adb shell rm /system/avi.apk

  34. 删除文件夹及其下面所有文件:

    adb shell rm -r

  35. 移动文件:

    adb shell mv path/file newpath/file

  36. 设置文件权限:

    adb shell chmod 777 /system/fonts/DroidSansFallback.ttf

  37. 新建文件夹:

    adb shell mkdir path/foldelname

  38. 查看文件内容:

    adb shell cat

  39. 查看wifi密码:

    adb shell cat /data/misc/wifi/*.conf

  40. 清除log缓存:

    adb logcat -c

  41. 查看bug报告:

    adb bugreport

  42. 获取设备名称:

    adb shell cat /system/build.prop

  43. 查看ADB帮助:

    adb help

  44. 跑monkey:

    adb shell monkey -v -p your.package.name 500

  45. 访问数据库SQLite3
    adb shell
    sqlite3


How to Use Android ADB Command Line Tool的更多相关文章

  1. Cordova 3.0 Plugin 安装 及"git" command line tool is not installed

    根据http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface Windows命令行 ...

  2. JMeterPluginsCMD Command Line Tool

    There is small command-line utility for generating graphs out of JTL files. It behave just like righ ...

  3. Cookies with curl the command line tool

    w https://curl.haxx.se/docs/http-cookies.html curl has a full cookie "engine" built in. If ...

  4. android adb command

    一.adb启动activity: $ adb shell$ am start -n {包(package)名}/{包名}.{活动(activity)名称} 如:启动浏览器 # am start -n ...

  5. xcode10对应的xcode command line tool编译的坑

    众所周知,xcode10新增的编译系统new build system会不支持一些老项目的编译,一般的做法是在Xcode编译配置Xcode->File->Project Settings/ ...

  6. NSRunLoop 在mac command line tool上的部分运用

    首先RunLoop相关博客参考这篇https://blog.csdn.net/lengshengren/article/details/12905627. 最近开发了一个mac上的命令行工具,我在主线 ...

  7. [Android ADB] An auto-input method for Android and Windows

    The Valentine's Day is coming. Here is an auto-input method and you may use it to send multiple word ...

  8. cURL POST command line on WINDOWS RESTful service

    26down votefavorite 7 My problem: Running windows 7 and using the executable command line tool to cu ...

  9. Building Xcode iOS projects and creating *.ipa file from the command line

    For our development process of iOS applications, we are using Jenkins set up on the Mac Mini Server, ...

随机推荐

  1. C#开发中常用方法1------日期计算

    /// <summary>/// 获取指定日期,在为一年中为第几周/// </summary>/// <param name="dt">指定时间 ...

  2. windows下node环境配置

    1.在node官网上下载合适版本的node安装包,官网地址:http://nodejs.org/#download:我下载的6.5最新版本: 2.安装node,都是系统默认的,一直安装下去: 3.在c ...

  3. Java EE之一个表单两个按钮响应不同界面(登录与注册)

    1.在前端,使用javaScript实现: <script> function logup(){ var element = document.getElementById('login- ...

  4. 《DSP using MATLAB》示例Example5.23

    代码: conv_time = zeros(1,150); fft_time = zeros(1, 150); % % Nmax = 2048; for L = 1:150 tc = 0; tf = ...

  5. 城管停车执法打印APP 移动云POS 现场打印告知单-执法平台+智能POS客户端系统

    市城管局城管支队工作人员使用最新配备的城管执法手持终端对便道违法停放车辆进行拍照取证. 城管执法手持终端具备拍照.现场打印.无线传输等功能,执法人员只要在该终端登录,即可随时实现对违停车辆的拍照取证. ...

  6. iOS 常用第三方类库、完整APP示例

    一.第三方类库 1:基于响应式编程思想的oc地址:https://github.com/ReactiveCocoa/ReactiveCocoa2:hud提示框地址:https://github.com ...

  7. Oldboy-Homework-Week1

    关于Python全栈开发第一周所讲的一些回忆(会陆续添加) 一.一些简单的命令.概念 1.print(""):输出 2.变量 3.input():输入 4.while循环.if.e ...

  8. ubuntu server 搭建自己的个人博客及其他网站

    一, 安装apache2服务器 sudo apt-get install apache2 二,安装mysql服务器 sudo apt-get install mysql-server 此时会提示输入M ...

  9. 转载:Chrome调试折腾记_(1)调试控制中心快捷键详解!!!

    转载:http://blog.csdn.net/crper/article/details/48098625 大多浏览器的调试功能的启用快捷键都一致…按下F12;还是熟悉的味道;  或者直接 Ctrl ...

  10. NSCache和NSURLCache、网络缓存优化

    本文目录 一种缓存优化方案 响应头'Last-Modified'和请求头'If-Modified-Since' 'Keep-Alive'响应头和不离线的URLSession 'Expires'响应头 ...