@ -1,103 +1,73 @@
#![Awesome Adb](./assets/title.png)
ADB [Android Debug Bridge ](https://developer.android.com/studio/command-line/adb.html ), it is not only irreplaceable powerful tool for Android developers/testers, but also a good toy to play with Android devices.
ADB ([Android Debug Bridge](https://developer.android.com/studio/command-line/adb.html)), it is not only irreplaceable powerful tool for Android developers/testers, but also a good toy to play with Android devices.
This repo is continuously updated, if you found mistake/issue please create issue or create pull request.
If you found that info useful [this GitHub repository ](https://github.com/mzlogin/awesome-adb ) please star this repo.
Thanks.
**Note:** There may be supported by part of the command and the version of Android and custom ROM implementation-dependent .
If you found [this GitHub repository ](https://github.com/mzlogin/awesome-adb ) is useful, please star this repo. Thanks.
#![Table of Contents](./assets/toc.png)
**Note:** Some commands may not supported well depends on the version of Android and ROM.
Other languages:
* [Chinese ](./README.md )
#![Table of Contents](./assets/toc.png)
<!-- vim - markdown - toc GFM -->
* [Basic Usage ](#Basic Usage )
* [Command Syntax ](#command syntax )
* [Targeting equipment for command ](#targeting equipment for command )
* [Start / stop ](#start stop )
* [See adb version ](#View -adb- version )
* [Running as root adbd ](#-root- permission to run -adbd )
* [Specify adb server network port ](#designated -adb-server- network port )
* [Device connection management ](#device connection management )
* [Query connected device / simulator ](#query connected device emulator )
* [USB connection ](#usb- connected )
* [Wireless connection (need to use USB cable) ](#-usb- wireless connection needs the line )
* [Wireless connection (without using the USB cable) ](#wireless connection without using -usb- line )
* [Application Management ](#application management )
* [Check the list ](#Check the list )
* [All Applications ](#all applications )
* [System ](#System )
* [Third-party applications ](#third-party applications )
* [Application package name contains a string ](#application package name contains a string )
* [Install APK ](#Installation -apk )
* [Uninstall Application ](#uninstalling )
* [Clear app data and cache ](#Clear app data and cache )
* [See the foreground Activity ](#View Reception -activity )
* [Application interacts with ](#interact with an application )
* [Transfer from the Activity ](#tone from -activity )
* [Transfer from Service ](#tone from -service )
* [Sending broadcast ](#sending broadcast )
* [Forcibly stop the application ](#forcibly stop the application )
* [File management ](#File Manager )
* [Copy device in the file to your computer ](#copy files to a computer inside the machine )
* [Computer files copied to the device ](#copy computer files to the device )
* [Simulation key / input ](#analog key input )
* [Power button ](#Power key )
* [MENU button ](#menu key )
* [HOME key ](#home- key )
* [Return key ](#Return key )
* [Volume Control ](#Volume Control )
* [Media Control ](#Media Control )
* [On / Off screen ](#on off screen )
* [Slide to unlock ](#slide to unlock )
* [Enter Text ](#input text )
* [View Log ](#View log )
* [Android Log ](#android- log )
* [Filter log by level ](#filter log by level )
* [Filter by tag and log level ](#filter log and press -tag- level )
* [Log formats ](#log format )
* [Clear Log ](#empty the log )
* [Kernel log ](#kernel log )
* [View Device Information ](#view device information )
* [Model] (#Model )
* [Battery status ](#battery status )
* [Screen resolution ](#screen resolution )
* [Screen density ](#screen density )
* [Screen parameter ](#display parameters )
* [Android\_id ](#android_id )
* [Basic Usage ](#basic-usage )
* [Command syntax ](#command-syntax )
* [Targeting equipment for command ](#targeting-equipment-for-command )
* [Start/Stop ](#startstop )
* [View adb version ](#view-adb-version )
* [Run adbd as root ](#run-adbd-as-root )
* [Designated adb server network port ](#designated-adb-server-network-port )
* [Device connection management ](#device-connection-management )
* [Inquiries connected device / simulator ](#inquiries-connected-device--simulator )
* [USB connection ](#usb-connection )
* [Wireless connection (need to use the USB cable) ](#wireless-connection-need-to-use-the-usb-cable )
* [Wireless connection (without using the USB cable) ](#wireless-connection-without-using-the-usb-cable )
* [Application Management ](#application-management )
* [All applications ](#all-applications )
* [Kernel log ](#kernel-log )
* [View device information ](#view-device-information )
* [Battery Status ](#battery-status )
* [Screen Resolution ](#screen-resolution )
* [Screen density ](#screen-density )
* [Display Parameters ](#display-parameters )
* [android\_id ](#android_id )
* [IMEI ](#imei )
* [Android system version ](#android- system version )
* [Android system version ](#android-system-version )
* [IP address ](#ip-address )
* [Mac Address ](#mac-address )
* [CPU information ](#cpu-information )
* [Memory Information ](#memory information )
* [More hardware and system attributes ](#More hardware, and system attributes )
* [Useful features ](#utility function )
* [Screenshot ](#screenshot )
* [Recording Screen ](#recording screen )
* [Remount system partition as writable ](#remount -system- partition writable )
* [See connection over WiFi password ](#see if the connection had -wifi- password )
* [Set the system date and time ](#Set the system date and time )
* [Restart the phone ](#to restart the phone )
* [Testing equipment whether root ](#detect whether a device is -root )
* [Use Monkey pressure tested ](#-monkey- use stress testing )
* [On / Off WiFi ](#open and close -wifi )
* [Brush related commands ](#Brush related commands )
* [Restart to Recovery mode ](#-recovery- to restart mode )
* [From Recovery to restart Android ](#reboot from -recovery- to -android )
* [Restart to Fastboot Mode ](#-fastboot- to restart mode )
* [Update via sideload system ](#-sideload- by updating the system )
* [More adb shell command ](#More -adb-shell- command )
* [See the process ](#view the process )
* [View real-time resource consumption ](#view real-time resource consumption )
* [Other ](#others )
* [FAQ ](#Frequently Asked Questions )
* [CPU Information ](#cpu-information )
* [Memory Information ](#memory-information )
* [More hardware and system properties ](#more-hardware-and-system-properties )
* [Utility functions ](#utility-functions )
* [Screenshots ](#screenshots )
* [Recording Screen ](#recording-screen )
* [Remount system partition as writable ](#remount-system-partition-as-writable )
* [Check connection over WiFi password ](#check-connection-over-wifi-password )
* [To set the system date and time ](#to-set-the-system-date-and-time )
* [restart cellphone ](#restart-cellphone )
* [Detect whether the device is root ](#detect-whether-the-device-is-root )
* [Monkey use stress testing ](#monkey-use-stress-testing )
* [On / off WiFi ](#on--off-wifi )
* [Brush related commands ](#brush-related-commands )
* [Restart to Recovery mode ](#restart-to-recovery-mode )
* [To restart from the Recovery Android ](#to-restart-from-the-recovery-android )
* [Restart to Fastboot mode ](#restart-to-fastboot-mode )
* [Through sideload system update ](#through-sideload-system-update )
* [More adb shell command ](#more-adb-shell-command )
* [See process ](#see-process )
* [View real-time resource consumption ](#view-real-time-resource-consumption )
* [common problem ](#common-problem )
* [Start adb server failure ](#start-adb-server-failure )
* [Adb unofficial implement ](#adb- unofficial realiz ation )
* [Credits ](#Credi ts )
* [Reference Links ](#reference links )
* [adb unofficial implementation ](#adb-unofficial-implementation )
* [Acknowledgements ](#acknowledgements )
* [Reference Links ](#reference-links )
<!-- vim - markdown - toc GFM -->
<!-- vim - markdown - toc -->
## Basic Usage
@ -116,7 +86,7 @@ If only one device / emulator connection, you can omit the `[-d | -e | -s <seria
If you have more than one device / emulator connection, you need to specify the target device for the command.
| Parameter | Meaning |
|---------------------|----------------------------------------------------|
|---------------------|----------------------------------------------------------------------------------- |
| -d | Specifies currently the only Android device USB connector as the command target |
| -e | Specify currently the only goal for the command to run the simulator |
| `-s <SerialNumber>` | Specifies the device number corresponding serialNumber / simulator command target |
@ -170,7 +140,7 @@ Android Debug Bridge version 1.0.36
Revision 8f855a3d9b35-android
```
### To run as root adbd
### Run adbd as root
The operating principle is adb adb server daemon and the phone side PC side adbd establish a connection, then the PC side adb client via adb server forward command parsing after running adbd receive commands.
@ -385,7 +355,7 @@ adb shell pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user USER_ID] [
That is the basis of `adb shell pm list packages` can add some parameters on the filter to view different lists, supports filtering parameters are as follows:
| Parameter | display list |
|------------|----------------------------|
|------------|------------------------------------------ |
| No | all applications |
| -f | Display apk file application association |
| -d | Show only applications disabled |
@ -465,7 +435,7 @@ parameter:
`Adb install` may be followed by some optional parameters to control the behavior of the installation APK, available parameters and their meanings are as follows:
| Parameter | Meaning |
|------|-----------------------------------------------------------------------------------|
|----------- |------------------------ -----------------------------------------------------------------------------------|
| -l | Will be applied to protect the installation directory / mnt / asec |
| -r | Allowed to cover the installation |
| -t | Allowed to install application specified in AndroidManifest.xml `android: testOnly =" true "` Application |
@ -502,7 +472,7 @@ Failure [INSTALL_FAILED_ALREADY_EXISTS]
Common Installation failed output code, the meaning and possible solutions are as follows:
| Output | Meaning | solutions |
|----------------------------------------------------|--------------------------------------------------------------------------|-------------------------------------------------|
|----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------- |----------------------------- -------------------------------------------------|
| INSTALL\_FAILED\_ALREADY\_EXISTS | application already exists | use `-r` parameters |
| INSTALL\_FAILED\_INVALID\_APK | invalid APK file | |
| INSTALL\_FAILED\_INVALID\_URI | invalid filename APK | APK file names to ensure no Chinese |
@ -626,7 +596,7 @@ Where `com.cyanogenmod.trebuchet / com.android.launcher3.Launcher` is currently
Primarily using `am <command>` command commonly used `<command>` as follows:
| Command | use |
|-----------------------------------|---------------------------------|
|-----------------------------------|---------------------------------------- |
| `Start [options] <INTENT>` | Start `<INTENT>` specified Activity |
| `Startservice [options] <INTENT>` | Start `<INTENT>` designated Service |
| `Broadcast [options] <INTENT>` | Send `<INTENT>` designated broadcast |
@ -637,7 +607,7 @@ Primarily using `am <command>` command commonly used `<command>` as follows:
Options for determining intent objects as follows:
| Parameter | Meaning |
|------------------|---------------------------------------------------------------------------------------------|
|------------------|--------------------------------------------------------------------------------------------------------------------------------------- |
| `-a <ACTION>` | specified action, such as `android.intent.action.VIEW` |
| `-c <CATEGORY>` | specify a category, such as `android.intent.category.APP_CONTACTS` |
| `-n <COMPONENT>` | specify the full component name, which is used to explicitly specify the start Activity, such as `com.example.app / .ExampleActivity` |
@ -645,7 +615,7 @@ Options for determining intent objects as follows:
`<INTENT>` can bring in data, like Bundle write code like:
| Parameter | Meaning |
|---------------------------------------------------------------|----------------------------------------|
|------------------------------------------------------------------ |----------------------------------------|
| `--esn <EXTRA_KEY>` | null value (only key name) |
| `-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE>` | string value |
| `--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>` | boolean value |
@ -722,7 +692,7 @@ Such usage is very practical in the test, such as a broadcast scenes difficult t
Both predefined broadcast transmission system can also send a custom broadcast. The following is part of the normal pre-defined radio and Trigger timing:
| Action | trigger timing |
|-------------------------------------------------|-----------------------------------------------|
|-------------------------------------------------|-------------------------------------------------------------------- |
| android.net.conn.CONNECTIVITY_CHANGE | Fi changes |
| android.intent.action.SCREEN_ON | screen lit |
| android.intent.action.SCREEN_OFF | screen off |
@ -834,7 +804,7 @@ The commands and default sources are:
Such as using `adb shell input keyevent <keycode>` command, different keycode to achieve different functions, keycode complete list see [KeyEvent] (https://developer.android.com/reference/android/view/KeyEvent. html), I think the interesting part of the quote is as follows:
| Keycode | Meaning |
|---------|--------------------------------|
|---------|-------------------------------------------------------------- |
| 3 | HOME button |
| 4 | return key |
| 5 | open dialing application |
@ -1547,7 +1517,7 @@ This will output a lot of information, including the previously mentioned severa
In output also includes some other useful information, they can also be `adb shell getprop <attribute name>` command alone, part of the property include the following:
| Attribute name | Meaning |
|---------------------------------|--------------------------|
|---------------------------------|------------------------------- |
| ro.build.version.sdk | SDK version |
| ro.build.version.release | Android system version |
| ro.build.version.security_patch | Android security patch level |
@ -1579,7 +1549,7 @@ adb pull /sdcard/sc.png
You can use the `adb shell screencap -h` See` help screencap` command, here are two significant parameters and their meanings:
| Parameter | Meaning |
|---------------|--------------------------------------------|
|---------------|------------------------------------------------------------------------------ |
| -p | Save the file in png format specified |
| -d Display-id | screenshots display the specified number (multiple screen display case next) |
@ -1604,7 +1574,7 @@ adb pull /sdcard/filename.mp4
You can use the `adb shell screenrecord --help` See` help screenrecord` command, the following are common parameters and their meanings:
| Parameter | Meaning |
|---------------------|-------------------------------------------------|
|---------------------|------------------------------------------------------------------------- |
| --size WIDTHxHEIGHT | dimensions of the video, such as `1280x720` , default screen resolution. |
| --bit-Rate RATE | bit-rate video, the default is 4Mbps. |
| --time-Limit TIME | recording length, in seconds. |
@ -1869,7 +1839,7 @@ shell 8750 217 10640 740 00000000 b6f28340 R ps
Meaning of each column:
| Listing | Meaning |
| ------ | ----------- |
|---------|------------------- |
| USER | their user |
| PID | Process ID |
| PPID | parent process ID |
@ -1905,7 +1875,7 @@ User 3 + Nice 0 + Sys 21 + Idle 280 + IOW 0 + IRQ 0 + SIRQ 3 = 307
Meaning of each column:
| Listing | Meaning |
|------|------------------------------------------------------------|
|--------- |------------------------------- ------------------------------------------------------------|
| PID | Process ID |
| PR | Priority |
| CPU% | instantaneous current occupancy percentage of CPU |
@ -1934,7 +1904,7 @@ Other ###
The following is a brief description of other commonly used commands, has previously spoken commands no special additional explanation:
| Command | function |
| ------- | ----------------------------- |
|---------|------------------------------------ |
| cat | display file contents |
| cd | change directory |
| chmod | change file access mode / access |
@ -1996,6 +1966,7 @@ Thanks for sharing with friends and selfless supplement.
* [seasonyuu ](https://github.com/seasonyuu )
* [fan123199 ](https://github.com/fan123199 )
* [zhEdward ](https://github.com/zhEdward )
* [0x8BADFOOD ](https://github.com/0x8BADFOOD )
## Reference Links