Adb Shell Commands Cheat Sheet



Android Debugger (ADB) cheat sheet By jjv360 20 March 2020 7 May 2020 adb is the command-line tool used for interacting with Android devices and debugging Android apps via the terminal. Output: As mentioned previously, the ls command displays a list of files and directories at the CLI's current directory. This happens to be the Android device's root directory until we move to a different one. If you plan to be making many commands via the Shell, you can also start an interactive Shell session. This can be done. The most exhaustive & definitive Android glossary. ADB: Android Debug Bridge. A utility to link the commands in the android through PC. (How to install & setup?) adb.exe can be taken from the SDK (already included in the android SDK). It is in the platform-tools folder. Acess help by typing 'adb help' adb shell.

A quick reference to ADB.

Created on: 2019-02-03

Tag: cheat_sheet

To see the list of all connected devices:

source: Query for devices

Adb Shell Commands Cheat Sheet 2020

To see the list of all packages:

source: Android: ADB – List Installed Package Names

To uninstall an app:

source: How to uninstall a system app using adb uninstall command (NOT remove via rm or any other way)

To backup system and app data but not the apps:

By default it saves device data to the platform-tools folder as backup.ab

source: How to Backup Your Entire Android Device to PC

To backup system and app data to a file but not the apps:

source: How to Backup Your Entire Android Device to PC

To restore data:

source: How to Backup Your Entire Android Device to PC

to backup and restore a specific app, first list all the packages with:

Now backup the specific package with:

The command above indicates that we want to backup com.whatsapp package to com.whatsapp.ab file as indicated with the -f flag. The .ab says it is an Adroid Backup file. The -noapk flag indicates that we don't want the .apk file to be backed up. Now we should see a confirmation dialog prompt to start the backup. The backup will not start until we press Back up my data.

We can convert the ADB backup file to a TAR archive. First we need to stripe the 24-bite header and the use openssl to decompress the raw zlib data:

Or we can use tail command instead of dd:

Now it is plain simple decompress with tar:

To restore just do:

But we have to take one more step to add 24-bite header to the .ab file if we changed the contains. For this we will also need the original .ab file.:

Pulse secure client download for mac. We can also use the head command to do that as well:

Now restore it like before:

source: https://stackpointer.io/mobile/android-adb-backup-extract-restore-repack/372/ and https://forum.xda-developers.com/showthread.php?t=2011811

Adb Shell Commands Cheat Sheet 2019

TO see the current activity:

source: ADB - Android - Getting the name of the current activity Download free microsoft word for mac os x.

To start an application aka an activity of an application:

source: How to start an application using android ADB tools?

To scroll up and down:

source: How can I scroll an application using adb?

To send text using virtual keyboard:

source: ADB Shell Input Events: answered by Rene Barbosa

To send keyevent as physical keyboard:

List of all key_code

source: ADB Shell Input Events: answered by LionCoder

Download

To tap aka click on screen:

source: How to use ADB to send touch events to device using sendevent command?

to see log of a specific package

source: adb shell Logcat with Package Name

we can use adb over wifi or specifically with a tcp connection. To use adb over wifi, first connect the phone via usb and enable usb debug. then list all device:

this should give a output like this:

now check the ip of the android device with:

output:

take note of the ip address after inet addr. we will need it later. now restart tcpip at some port with:

for example 5555:

you can disconnect the use now. to connect to the device now just give the following command:

like:

source: How can I connect to Android with ADB over TCP? and Android Debug Bridge (adb) | Android Developers: Connect to a device over Wi-Fi

to take a screenshot:

or save it in phone then pull:

source: which commands line are used to take a screenshot on android device (except screencap)

changes are divided into 3 namespace: system, secure, global. we can get, put, delete individual keys and list all in a namespace. to list all in system:

get, put and delete the same:

source: adb command to open settings and change them

source: https://stackoverflow.com/a/10038568

to specify particular device among multiple devices:

source: https://stackoverflow.com/a/14655015source: https://developer.android.com/studio/command-line/adb#directingcommands

to copy files to a device: Download pdf software for mac.

to copy files from a device:

source: https://developer.android.com/studio/command-line/adb#copyfiles

to launch fragments:

The -e :android:show_fragment part is important here.

source: https://stackoverflow.com/a/21844594

to get events:

source: Getevent | Android Open Source Project

to kill an app:

source: https://stackoverflow.com/a/12274218