This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
Android Debug Bridge¶
ADB is a versatile CLI tool that lets you communicate with an android device. The
facilitates a variety of device actions, such as installing and debugging apps, and it provides
access to a Unix shell that you can use to run a variety of commands.
table of contents¶
In your android device, do the following:
Enable developer options: https://developer.android.com/studio/debug/dev-options#enable (go in settings -> about phone -> build number -> tap the build number option 7 times)
Enable ADB: https://developer.android.com/studio/debug/dev-options#enable (go in settings -> system -> developer options -> Android debugging on)
access android services
go in settings -> system -> developer options -> running services
access android memory stats
go in settings -> system -> developer options -> memory
access android local terminal app
go in settings -> system -> developer options -> local terminal
Install the android SDK platform tools:
On Arch based distros, install
$ mkdir -p ~/apps/aur-apps $ cd ~/apps/aur-apps $ git clone https://aur.archlinux.org/android-sdk-platform-tools.git $ cd android-sdk-platform-tools $ makepkg -si # --syncdeps to auto-install deps, --install to install after building
Install android-sdk-platform-tools from
Now if you connect your android device to your computer via USB, you will be able to run
adbcommands after running the ADB server:
E.g. for the android finder application.
Enter ADB shell:
Exit ADB shell:
Print current user:
Print installed packages:
Print local storage location:
$ sudo /opt/android-sdk/platform-tools/adb shell echo $EXTERNAL_STORAGE > /sdcard $ sudo /opt/android-sdk/platform-tools/adb shell ls $EXTERNAL_STORAGE > ... $ sudo /opt/android-sdk/platform-tools/adb shell ls /sdcard/DCIM # this location may vary depending on your device > ... $ sudo /opt/android-sdk/platform-tools/adb pull /sdcard/DCIM/OpenCamera /path/to/your/download/folder
If you get the following error when running
adb: device unauthorized. This adb server's $ADB_VENDOR_KEYS is not set Try 'adb kill-server' if that seems wrong. Otherwise check for a confirmation dialog on your device.
Restart the ADB server:
adb kill-server && adb start-server
Next time you use
adbto access the device, a pop-up will appear on the device asking to allow to connect to the
If this cheat sheet has been useful to you, then please consider leaving a star here.