Catalog / ADB (Android Debug Bridge) Cheatsheet
ADB (Android Debug Bridge) Cheatsheet
A concise reference for ADB commands, covering device management, file transfer, shell interaction, and more, tailored for Android developers and enthusiasts.
Device Management
Basic Device Commands
|
Lists all connected Android devices. Shows serial number and state (device, offline, unauthorized). |
|
Lists connected devices with more details like transport ID and product/model information. |
|
Prints the device’s current state (device, offline, unauthorized, unknown). |
|
Retrieves the serial number of the connected device. |
|
Blocks execution until a device is connected. Useful in scripts. |
|
Kills the ADB server process. The server will restart automatically when another ADB command is executed. |
|
Starts the ADB server. Usually not required as ADB commands start the server if it’s not running. |
Device Selection
|
Specifies the device by serial number to execute the command on. Useful when multiple devices are connected. Example: |
|
Directs the command to the only connected emulator. Returns an error if more than one emulator is running. |
|
Directs the command to the only connected hardware device. Returns an error if more than one device is connected. |
Reboot Commands
|
Reboots the Android device. |
|
Reboots the device into the bootloader (fastboot) mode. |
|
Reboots the device into recovery mode. |
File Management
File Transfer
|
Copies a file or directory from your computer (local) to the Android device (remote). Example: |
|
Copies a file or directory from the Android device (remote) to your computer (local). Example: |
Shell File Operations
|
Lists files and directories in the specified path on the device. Use Example: |
|
Creates a new directory at the specified path on the device. Example: |
|
Removes the file at the specified path on the device. Example: |
|
Removes the directory recursively at the specified path on the device. Example: |
|
Moves a file from source to destination path on the device. Example: |
Shell Commands
Basic Shell Interaction
|
Executes a shell command on the Android device. Example: |
|
Opens an interactive shell session on the Android device. Type |
|
Runs emulator console command. Example: |
Package Management
|
Installs an Android application package (APK) from your computer to the device. Example: |
|
Reinstalls an existing application, keeping its data. Example: |
|
Uninstalls the application with the specified package name from the device. Example: |
|
Lists all installed packages on the device. |
|
Clear user data of a package. Example: |
Screen and Media
|
Takes a screenshot of the device screen and saves it as a PNG file on the device. Then use |
|
Records a video of the device screen and saves it as an MP4 file on the device. Press Ctrl+C to stop recording. Then use |
Debugging & Logging
Logcat Commands
|
Starts streaming system log messages to your console. |
|
Clears the current log buffers. |
|
Specifies the log message format ( Example: |
|
Filters log messages by tag and priority level ( Example: |
|
Saves the log output to the specified file. Example: |
|
Filters logcat output using grep for specific strings. Example: |
Debugging Applications
|
Lists the process IDs (PID) of all applications that are enabled for JDWP (Java Debug Wire Protocol) debugging. |
|
Sets up port forwarding for debugging a specific application process. Example: |
|
Starts an application in debug mode, waiting for a debugger to attach. Example: |
ADB over Network
|
Restarts ADB in TCP/IP mode on the specified port (usually 5555). Run on the device itself (via USB connection). |
|
Connects to the device over the network. Run on the computer after enabling |
|
Disconnects from a network-connected device. Example: |