Linux command
adb 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List
adb devices
Install
adb install [app.apk]
Copy file
adb pull [/sdcard/file.txt] [./local/]
Copy file
adb push [local_file] [/sdcard/]
Example
adb shell
Pair
adb pair [host]:[port]
Connect
adb connect [host]:[port]
说明
adb (Android Debug Bridge) is a versatile command-line tool for communicating with Android devices. It provides access to a Unix shell for running commands, installing/uninstalling apps, transferring files, and debugging applications. The tool operates through a client-server architecture where the adb server runs on your computer and communicates with the adb daemon (adbd) on connected devices. Connections can be made via USB or wirelessly over TCP/IP.
参数
- -d
- Direct command to the only connected USB device
- -e
- Direct command to the only running emulator
- -s _serial_
- Direct command to device with specified serial number
- -t _transport_id_
- Direct command to device with given transport ID
- devices
- List all connected devices and their states
- install -r -g _apk_
- Install an APK file. -r reinstalls keeping data, -g grants all runtime permissions.
- uninstall -k _package_
- Remove an application by package name. -k keeps data and cache directories.
- pair _host_:_port_ _pairing_code_
- Pair with a device for wireless debugging (Android 11+).
- connect _host_:_port_
- Connect to a device over TCP/IP.
- push _local_ _remote_
- Copy file from computer to device
- pull _remote_ _local_
- Copy file from device to computer
- shell
- Open interactive shell or run command on device
- logcat
- View device log output
- forward _local_ _remote_
- Set up port forwarding
- reverse _remote_ _local_
- Set up reverse port forwarding
- reboot
- Reboot the device (bootloader, recovery options available)
- start-server
- Start the adb server
- kill-server
- Stop the adb server
- sideload _otapackage_
- Sideload an OTA update package in recovery mode
- bugreport _path_
- Generate a bug report and save to path
FAQ
What is the adb command used for?
adb (Android Debug Bridge) is a versatile command-line tool for communicating with Android devices. It provides access to a Unix shell for running commands, installing/uninstalling apps, transferring files, and debugging applications. The tool operates through a client-server architecture where the adb server runs on your computer and communicates with the adb daemon (adbd) on connected devices. Connections can be made via USB or wirelessly over TCP/IP.
How do I run a basic adb example?
Run `adb devices` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d do in adb?
Direct command to the only connected USB device