ADB (Android Debugger) Cheatsheet

Since my samsung uses a custom ROM called Lineage OS and since the device is rooted, it lets me play around inside the Linux environment.

Oddly enough i cant get this working on any of my Chromebooks but it works fine on both my macbook and on my Debian Linux computers.

Start the android debugger
# adb start-server

Check if you device is found
# adb devices

Create a full backup of your phone and save to the computer.
# adb backup

Restore a backup to your phone.
# adb restore

Push and flash custom ROMs and zips from your computer.
# adb sideload

Try to access a terminal
# adb shell

Send SMS
am start -a android.intent.action.SENDTO -d sms:0720XX76XX --es sms_body "Test" --ez exit_on_sent false

Ring ett samtal
# am start -a android.intent.action.CALL -d tel:0720XX76XX

Enter text
# input text 'Some text'/code>

Take screenshot
# screencap -p /sdcard/screenshot.png

To retrieve image from phone
# adb pull /sdcard/screen.png

Save video of screen
# screenrecord /sdcard/NotAbleToLogin.mp4

Simulate pressing home-button
# am start -W -c android.intent.category.HOME -a android.intent.action.MAIN

List of keyevents

adb shell input keyevent 3 // Home btn
adb shell input keyevent 4 // Back btn
adb shell input keyevent 5 // Call
adb shell input keyevent 6 // End call
adb shell input keyevent 26  // Turn Android device ON and OFF. It will toggle device to on/off status.
adb shell input keyevent 27 // Camera
adb shell input keyevent 64 // Open browser
adb shell input keyevent 66 // Enter
adb shell input keyevent 67 // Delete (backspace)
adb shell input keyevent 207 // Contacts
adb shell input keyevent 220 / 221 // Brightness down/up
adb shell input keyevent 277 / 278 /279 // Cut/Copy/Paste

Check connection and get basic information about devices connected to the computer. This is essentially the same command as adb devices from earlier. However, it works in the bootloader, which ADB does not. Handy for ensuring that you have properly established a connection.
# fastboot devices

Lock/Unlock android device. It will toggle device screen ON/OFF.
# input keyevent 26

Clear all textmessages
# pm clear

Leave a comment

Your email address will not be published. Required fields are marked *