• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root (How To) ADB commands

t0ast3d

Android Enthusiast
If you find this helpful or think it would be helpful to others, tip it for a sticky!


Here's a little guide I put together for you to learn basic adb commands.


I'm posting this thread assuming you already have your SDK set up


With that said, let's dive right in!



1. Turn on ADB

Go to Menu > Settings > Applications > Development > USB Debugging


2. Running ADB

Open up command prompt and type your way to the directory you have your SDK in.

Mine is in C:\

So for example, mine would be: cd c:\AndroidSDK/tools

You are now in


3. Basic ADB commands

ADB push (sends files to your phone) -- adb push c:\example.apk /sdcard/example.apk

ADB pull (Receives files from your phone) -- adb pull /system/app/example.apk c:\example.apk

ADB install (installs application) -- adb install c:\example.apk

adb shell (Begins shell connection with phone)

adb reboot (reboots phone)

adb reboot recovery (reboots phone into recovery)

adb reboot bootloader (reboots the phone into bootloader/the white screen)

adb remount (remounts the system)


4. Commands to run while in ADB Shell

cd (changes directories) -- cd /system/app

ls (lists all files in the directory) -- ls /system/app

rm (removes files) -- rm /system/app/example.apk

cp (copies files) similar to cat -- cp /system/app/example.apk /sdcard/example.apk

cat (copies files) -- cat /system/app/example.apk > /sdcard/example.apk

exit (exits shell) -- exit


Might add a little more later if requested/clean it up

Hope you learned something!
 
cp doesn't exist with the default shell. It becomes available if you install busybox. But then you get a ton of other common shell commands as well. A lot of ROMs come with busybox now, but not all.

Thanks for doing a tutorial :)
 
cp doesn't exist with the default shell. It becomes available if you install busybox. But then you get a ton of other common shell commands as well. A lot of ROMs come with busybox now, but not all.

Thanks for doing a tutorial :)

Yeah, but most if not all the mainsteam ROMs have it.

No problem.
 
:)

The ADB server is A server a background process on your development machine - e.g. Windows PC. The ADB server manages communication between the client and the adb daemon running on an emulator or device. The ADB commands that are essential to start ADB Server and connect to Device are:


Terminates the adb server process that is running in the background


ADB kill-server


Check whether the adb server process is running in the background. Start it if it is not running in the background:


ADB start-server


Know what emulator/device instances are connected to the adb server. Generate a list of attached emulators/devices:


ADB Devices


This command produces Device/Emulator serial number and itis state - whether online or offline.

:)
 
:)

If one wants to debug or see behind the scenes what an App is doing, then use following ADB Commands:


ADB logcat > /sdcard/adblogcat.txt

Run the App that you want to debug on the Phone


When done, press

Ctrl + c


ADB pull /sdcard/adblogcat.txt C:\adblogcat.txt


:)
 
I have not used adb at all but do have sdk and the like ready to go I set it all up when trying to push a bootanimation just to find out that my hboot version ( 2.10 ) does not support this.. I wondering if I can still use shell commands or do a pull or install with adb
 
:)

If one wants to debug or see behind the scenes what an App is doing, then use following ADB Commands:


ADB logcat > /sdcard/adblogcat.txt

Run the App that you want to debug on the Phone


When done, press

Ctrl + c


ADB pull /sdcard/adblogcat.txt C:\adblogcat.txt


:)
I'm gonna have to try this to logcat
 
You said your way to the directory to sdk is cd c:\AndroidSDK/tools ........................how come .What is cd supposed to be here ?

I mean basically shouldnt it be c:\"installation folder" or c:\program files\"installation folder"
If you find this helpful or think it would be helpful to others, tip it for a sticky!


Here's a little guide I put together for you to learn basic adb commands.


I'm posting this thread assuming you already have your SDK set up


With that said, let's dive right in!



1. Turn on ADB

Go to Menu > Settings > Applications > Development > USB Debugging


2. Running ADB

Open up command prompt and type your way to the directory you have your SDK in.

Mine is in C:\

So for example, mine would be: cd c:\AndroidSDK/tools

You are now in


3. Basic ADB commands

ADB push (sends files to your phone) -- adb push c:\example.apk /sdcard/example.apk

ADB pull (Receives files from your phone) -- adb pull /system/app/example.apk c:\example.apk

ADB install (installs application) -- adb install c:\example.apk

adb shell (Begins shell connection with phone)

adb reboot (reboots phone)

adb reboot recovery (reboots phone into recovery)

adb reboot bootloader (reboots the phone into bootloader/the white screen)

adb remount (remounts the system)


4. Commands to run while in ADB Shell

cd (changes directories) -- cd /system/app

ls (lists all files in the directory) -- ls /system/app

rm (removes files) -- rm /system/app/example.apk

cp (copies files) similar to cat -- cp /system/app/example.apk /sdcard/example.apk

cat (copies files) -- cat /system/app/example.apk > /sdcard/example.apk

exit (exits shell) -- exit


Might add a little more later if requested/clean it up

Hope you learned something!
 
You said your way to the directory to sdk is cd c:\AndroidSDK/tools ........................how come .What is cd supposed to be here ?

I mean basically shouldnt it be c:\"installation folder" or c:\program files\"installation folder"

you do not have to have cd in front. unless you are in a different directory. the whole idea is that you point the command in the right path. so that where ever your adb folder is at that is where the command should be.

i find that if you right click while holding down shift and select open command window here option (only works in windows 7) to be the easiest way.
 
Back
Top Bottom