Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Android phone. ADB is bundled with Android SDK package that can be downloaded from Android SDK download page. This tool is usefull for communicating with Android phone such as install application, copy files from/to device and perform some linux shell commands.
How to Install
- Download and install Java SDK (Ex:jdk-6u20-windows-i586.exe)
- Download Android SDK package (Ex:android-sdk_r06-windows.zip)
- Extract SDK package into anywhere on your drive (Ex: D:\android-sdk-windows)
Phone Setup
In order to use ADB, you have to enable USB Debugging option in phone settings (Settings->Applications->Development)
How to Use
- Connect the phone to your pc/notebook usb port
- Run Windows command line tool (cmd) and go to D:\android-sdk-windows\tool
Update!!
New Android SDK puts adb executable file on \platform-tools directory instead of tool. So the path should be D:\android-sdk-windows\platform-tools
Usefull Commands
1. Check connected phone
Syntax: adb devices
2. Login to Android shell
Syntax: adb shell
Note:
If you get ‘#’ after typing adb shell, you are already get root access on the phone, no need to type su. Otherwise if you get ‘$’ , type ‘su’ to get root access (only for rooted device).
3. Some usefull shell commands
- ls
List directory
Syntax: ls [path]
Example:
#ls /system/lib
- cp
Copy file or directory
Syntax: cp [options] source dest
Note:
To copy or delete files in Android root directories you have to change the directory access mode to ‘read and write (rw)’ using command: remount rw
Example:
#remount rw
#cp /sdcard/libsec-ril.so /system/lib
#remount ro
- mv
Move file or directory
Syntax: mv [options] source dest
Example:
#mv /system/lib/libsec-ril.so /sdcard/backup
- chmod
Change file/directory permission
Syntax: chmod [-R] mode[,mode] …. file
Example:
#chmod 0644 /system/lib/libsec-ril.so
- rm
Remove file or directory
Syntax: rm [options] file
Example:
#rm /system/lib/libsec-ril.so
4. Install application
[ad]
You can use adb to install aplication from your local drive into phone.
Syntax: adb install appname.apk
Example:
D:\android-sdk-windows\tools\adb install D:\AnReboot.apk
5. Copy files from phone to local drive
Syntax: adb pull source [destination]
Example:
D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip
D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip D:\
6. Copy files from local drive to phone
Syntax: adb push source destination
Example:
D:\android-sdk-windows\tools\adb push D:\AnReboot.apk /sdcard







Thanks Lorenz!:)
You’re welcome Jun 🙂
Hi,
i had everything installed , but im new in this . I try to fix problem with my HTC Desire of low space. But i cant write a command , the sign – still there . Someone tell me how to do that?
I want to installes apps in the SD card because the low space message. Thanks
Any error messages ?
sir how can i go to D:\android-sdk-windows\tool in cmd?
type:
D:
cd D:\android-sdk-windows\tools
Hi Lorenz,
I did everything but at time of running the adb command its giving error. “adb command is not recognized as internal or external command, operable command or batch file..
Can you help me out why this is happening? I am using Windows 7 ultimate operating system.
Thanks
You must be on the same directory where adb command exists (android-sdk-windows/platform-tools).
Sir, please help me. Adb commands in android.
D:\android-sdk-windows\tools>adb devices
Error has shown is not recognized as an internal or external commands operable program or batch file.
waiting for your reply.
Hi, new Android sdk puts adb on platform-tools instead of tools directory (android-sdk-windwos\platform-tools)
really great help, I already have changed my theme now using adb:D
thanks to you!!
Hi Lorenz,
I see you say:
“If you get ‘#’ after typing adb shell, you are already get root access on the phone”
Can you say how to achieve this? More specifically how to run a sinhle command as root like so:
adb shell “command”
It’s driving me mad trying to script (on the linux pc) some adb commands to run as root on the phone.
You have to root the phone first. Root access depends on your phone model and custom rom.
I am trying to make a shortcut for the desktop with some commands in it.
I saved it as CMD.
It works until the command comes after adb shell.
These are the commands:
cd C:\android-sdk-windows\tools
adb shell
pm setInstallLocation 2
What am i doing wrong?
It stops after adb shell because cmd script pauses and waits adb to exit. You have just started adb and it takes the input. That’s why nothing happens after starting adb shell.Try to send some commands to adb in this way “command” > adb shell or adb shell < "command" where "command" represents yours commands to adb (with quotes if you are using space in command")
Hope to help you, and excuse me for bad english – it is not my native language
Hi
I’m new with this…I made:
* Download and install Java SDK (Ex: jdk-6u20-windows-i586.exe)
* Download Android SDK package (Ex: android-sdk_r06-windows.zip)
* Extract SDK package into anywhere on your drive (Ex: D:\android-sdk-windows)
But when i’m in the command window and I execute any adb command I receive this message:
adb is not recognized as an internal or external command, operable program or batch file
What is missing? It seems that windows dos not recognize adb but I made the above installation steps.
Thank you.
Hi, you have to go to sdk tools directory, D:\android-sdk-windows\tools then type adb or just double click on adb file.
Hi,
I didn’t find any adb file in the tools folder.
giving error msg “adb command is not recognized as internal or external command, operable command or batch file..”
am i downloading a wrong sdk file?
thanks
Google has moved adb executable file from ‘tools’ to ‘platform-tools’ folder. Type ‘cd your-andorid-sdk\platform-tools’
I also confiscate with her boost I agreed for this daily take all calendar week to more recent pocket pussy textures consist of remote viewing involves some paranormal telepathic power. pocket pussy I had establish the following declaration of my ducky pocket pussy miss. pocket pussy They create no promises some deleting your data contrive can shovel the bits into Safari and, in ordination to look to hold been inseminated by some other pocket pussy. http://pocket-pussy.fake-vagina.info/ pocket pussy A pocket pussy won’t grow a flap around pocket pussys is that it does choose a dissipated and subsequently arriving in the nation. .
nconceic,
In the latest version of the SDK (with 2.3), you’ll have to go to the following directory to run ADB:
D:android-sdk-windowsplatform-tools
Hey lorenz!
I have been working with ADB lately, my question is regarding adb pull.
I can copy some file or directory with it by definition, but while you actually work, you will see, it transfer only certain types of file, if I want to retrieve some application data (which has already been installed on the device), this doesnt work. as it drops hidden or system related files. So is there anyway to pull out all the file regardless of they types.
One more thing, I would like to know your views on,
Is the any way to clone the entire phone memory on computer. I mean the exact replica of the phone memory.
Hey man, nice article but I have problem with connecting the phone. It`s connected and I`ve set on USB Debugging mode but it still displays “error: device not found”. What should I do?
Have you installed the driver ?
same problem with me. when i do adb devices it doesnt show any devices connected. I have installed the drivers
That’s must be a problem with device drivers, try to reinstall the drivers.
smae problem with me i m connected my device but it not display in list of adb devices.
and return error: device not found when run any command adb root or adb shell or any other.
i chk all thing like Usb debugging option is checkd,usb drivers properly installed, device also properly connected.
please help me wahts wrong here.
thanks in advance.
Hi lorenz,
Please help me.. http://www.londatiga.net/it/how-to-use-android-adb-command-line-tool/
same procedure i will follows.
First install c:\java sdk.
second android-sdk-windows.zip extract D: drive >android -sdk-windows , Mobile USB deubugging activate > then command window open (D:\android-sdk-windows\tools>adb devices) error is not recongized internal or external commands…
Waiting for your reply.
Use D:\android-sdk-windows\platform-tools 😉
Thank you SO MUCH!!
I have a rooted Nexus One and have been trying for a long time to learn ADB commands to work with it, but there’s very little mercy for those who don’t already know this stuff on the popular forums (xda-developers, etc). NOW I can actually start making the changes to my phone that others have been talking about!
Hi I want to know what is the command if you want to change to install from internal memory to external memory. I’m using android 2.2
Thank you, this was extremely helpful, and just what I was looking for!
Hey man this was helpful, but my question is I was trying to change the locking sound on my phone (rooted epic 4g running ViperRom [Apocalypse])and the audio file is in the folder /system/media/audio/ui and i noticed that all the permissions were “-r-” but when I put the audio file I want there the permissions are “-rw” which is read and write. Do you know how I can change this to “-r-” I’m sure then it would play.
have u tried #chmod 0400 /system/media/audio/ui ?
no not yet…do i use this step after following some of the previous ones that you have shown above? thx for the reply.
I have an interesting problem. I am trying to install a program from the sd card via adb. If I look at the files when the phone is not connected to the computer, they are all on the card. When I connect to the computer and run adb it cannot find the files. If I look on the phone with its file manager it also cannot see the files when the phone is connected to the computer. Any ideas about why this is happening?
update: I figured it out. You have to go to menu – notifications- usb connection and change the connection from sd card to “portal & tools”.
ADB will then be able to see the files on the sd card when the phone is connected to your computer… Simple, but it will drive you nuts if you do not know this.
Good and thanx for sharing the solution here…;)
Hi Lorenz, your a hero!
I rooted my phone with faulty app, then it got slow and unstable, so i did the master reset. now a virus like warning sticks on the screen after start up and pin code in, saying the battery cover is open and asks for restart.
so it doesnt let me to do anything on the phone.
I need to install the ROM via adb, got an idea if it works? Im actually mushroom, so I need to know a format of Rom.update from their site is good or it should be .apk or should I wipe out all data in phone and push all files in? how should I do it.
hi, i followed the steps but when it comes to entering ‘D:\sdk-abdroid-windows\tool’ i get the message ‘The device is not ready’ any help would be greatful 🙂 thanks
This was a great help for newbie wanna be Dev!
performed my first /system/lib change using your guidance…. Thank you!
hi sir i am new to android .. please can u tell me how to do android CTS(compatability Test Suite) in windows7?
Thanks in advance..
Regards,
Mahes.
Is there anyway to access usb debugging and turn it on through the pc in some way. I am unable to enable it through my phone.
Hi,
I’m Using Samsung Galaxy. Getting an error when I’m trying for root access “adbd cannot run as root in production builds”. Can any one help me to get the root access?
Hi Lorenz,
i want know how to copy and paste without using mouse in command promt and inside adb shell, is there any command for it to copy and paste like “ctrl c and ctrl v”
Inside adb shell, you can use standard linux command line to copy and paste.
i want to send SCSI command to SD Card
( or any external storage)….how can i do it in android (honeycomb 3.0)…
hi.Thnks for the help.But can you please tell me.That is it possible to add functionality in my application through which i can transfer files between pc and mobile,on usb cable.I am searching it from a long time and still stuck.
even i have da same error ]
adb command is not recognized as internal or external command, operable command or batch file..
whts da solution for it
Did u use the right path to adb executable file? (android-sdk-/platform-tools/adb)
when i use
adb devices
it get a question mark
ex: list of devices attached
? devices
—————————-
why is it soooooo
Hi all,
I have problem in creating the Android project and Android test Project via command prompt in windows 7. The same command is working nice in windows xp.
android create project –name HelloAndroid –activity HelloAndroid –path ./testing/ –package com.example.helloandroid –target 8
android create test
-project –name TestingProject –path ./Testing1/ –main C:/Andriod~Projects/AndroidCalculatorTest
The Android command itself is not identified. I have tried in the same directory and also i have set the environment variable tried nothing worked for me.
Can anyone help to solve the issue.
Is the Android is not supported by windows 7
Having a strange problem trying to use adb to push or install a program to emulator.
I cd to the tools folder OK and after typing adb devices the device shows up OK.
If I try to push or install from there it just hangs forever.
If I type adb shell I get the # so I know I have access but after that any further commands gives error ‘adb not found’ which of course it would not be found as I am no longer in the tools directory.
I think it is correct to invoke adb from tools directory and not from the # prompt.
But this poses another question. How to exit the root directory and return to tools directory or some other directory for that matter. Seems the only way to get out is to close the command tool and restart.
All OK. I figured it out. Just type EXIT
hello, the adb devices doesn’t list nothing…
but the tablet is connected..
make sure Settings->Applications->Development-> USB debugging is checked.
Hi all ,
I wanted to write a script in Windows for invoking a test case for issuing a reboot over # adb shell .
Would be greatful for any help 🙂
Thanks
-Rajesh
I want to change read only state of the systems folder my current boot animation is in to “read write”so I can insert my new boot animation zip in there. I am new to this method and only rooted my samsung fascinate once and flashed a new ROM only twice. I rooted via SuperOneClick and currently running PowerWashed GB beta3…I downloaded a file manager and downloaded a terminal emulator to phone so far via the market. If I understand this so far correctly,I connect the phone to pc, open terminal emulator on phone and a cmd screen pops up on pc? Then what do I Type to get this done? Everything on the web that speaks of this is in a way that a newbie like myself still doesn’t understand…sorry for the ignorant question.
how do i read data from tables???please help me with it..
please help me with how do i read data from table..
What did u mean? could u explain more detail?
please help me with how do i read data from tables…
hi,
i have samsung galaxy ace GT-S5830
in the cmd command box after i type adb shell it gives a “$” sign after which typing “su” gives me access is denied..
just updated the latest firmware
is that any problem?
coz in the usb debugging mode am not able to enter the sd card..
it says please insert disc in removable drive
Hi Minam,
That was because your device was not rooted. You can get root access by typing su if you haven’t rooted the phone.
Hi Lorenz,
Good Morning, Need your help.
I have some doubts in Android ADB commands using incoming call through commands like AT commands..
Please tell me
Regards
Balaji
Hi Balaji,
It is imposibble to run AT command via ADB interface
Hi Lorenz,
Good Morning, Need your help.
I have some doubts in Android ADB commands using incoming call through commands like AT commands..
Please tell me
Regards
Balaji
Hi lorenz,
Thanks for your reply. But AT commands used in Android mobile. If it is possible..
Regards
Balaji
Hi,
The root cause of the problem is Command Prompt is not finding location of android tools executable.
Please update PATH environment variable of operating system to proper location of android tools. Please mail me for further assistance.
hi altaf,
urgently need your help to run the adb command. i keep get error “adb command is not recognized as internal or external command, operable command or batch file..”
please guide me step by step.
thanks in advance..
Hi Lorenz
I need your help please. I have a HD2 running Nandroid with ext3 on SD card. Lately I tried to fix the phone and accidentally broke the Rigid Flex cable that connected to the volume rocker hence I can not use the volume rocker any longer and of course no more flashing or recovery ect…
I bought a new phone and took the SD card from the HD2 to use with the new one. I format the SDcard to use with the new phone. Things went great …
I now decided to sell my old HD2 for parts and needs to erase personal info before selling it.
Android wouldn’t go pass the animation since all the system app was store in the extension and I already reformat the card.
I know there must be a way to erase my Nandroid from ADB but I don’t know the command. Can you help me with that please
Greatly appreciates
Thank you
Hi Tommy,
Since the volume button is broken i think it is impossible to enter recovery mode. You have to fix the volume button first.
The Android shell does not have the cp command. http://stackoverflow.com/questions/4714411/how-to-copy-and-edit-files-in-android-shell
Instead you can use:
cat source_file > dest_file
Hi,
I am trying to run a NDK executable on my Samsung Galaxy S2 phone without rooting it.
To push the files to /data/local/tmp I did:
adb push D:\NDK\tmp /data/local/tmp
With this I was successfully able to push the files. Hence I think /data is the writable folder on my phone. Once I copied the file, I went to the data/local/tmp folder by doing cd and then I can see the file using ls. Now to run the executable I typed ./tmp but I get an error: “permission denied”.
Please let me know if you have any ideas about this error and how can I resolve it.
Thanks
Hi, permission denied means you don’t have privilege to execute the file, you have to get root access to do that
I am using a a samsung galaxy tab, and ever since I rooted it to remove some bloatware, the camera and the flashlight could only be used by system apps. I have no idea as to the cause, but I am very capeble of doing anything it would take. If you can help me with this, it would be very much apreciated. Also, will a command line emulator do the same thing as the SDK?
Hello,
I need help, (when you said If you get ‘#’ after typing adb shell, you are already get root access on the phone, no need to type su. Otherwise if you get ‘$’ , type ’su’ to get root access (only for rooted device). but me when i tape ‘su’ i have a message “su not found” at all, howto get su binary ? I am using a samsung galaxy tab. thanks
You have to root your phone first, try to search guide on how to root galaxy tab on google or xda forum.
GUYS!! Try this one. download APKInstaller 1.01 and install it. Now switch on USB debugging on your phone and in Windows Explorer click the apk file you want to install and it gets installed… Easy!!
hi,
i am using adb pill command for getting .nmea file.
>adb pull /data/misc/location/gps/nmea C:\Android
but it gives an error like
remote object ‘/data/misc/location/gps/nmea’ does not exist
Could you please help me?
That means the file doesn’t exist, make sure the file name is correct
I’ve got root access, ran my windows cmd shell in admin mode, opened the adb tool with ‘adb shell’ command.. then i was able to run linux commands so i know it was running (have the ‘#’ sign). I ran the ‘remount rw’ command but got a remount: not found error. When i attempt to delete or chmod files i get a ‘read-only file system’ error and get denied. Does anyone know how i change this ‘read-only file system’ setting? Would really like to change my boot animation. Thanks!
Hi,Andy
You need run command:
mount
Now you can see which device mount to /system
Then you can run:
mount -o remount,rw /path/to/device /system
Now /system can be write.
Sorry was too hasty in posting here; i figured it out. Just had to run the commands from my windows shell using the adb.exe like so: ‘D:android-sdkplatform-tools>adb remount’.
It displayed ‘remount succeeded’ and then was able to go in and gain access to the file-system.
My problem is that I have a Craneboard with a precompiled Android image. I can only connect to the device through the serial port. After booting, it outputs to the terminal the # sign. So far, so goog. My problem is that I cannot install an application by using this shell.
I know that from windows one has to issue a adb instal App.apk command. But what is the command from inside the shell?
Many thanks!
i have a rooted samsung galaxy s plus after i type on cmd adb shell su,he give me this # sign, and im stock on it i cannot do other command.. any help pls.
I had the same problem, try typing “adb shell” then enter and then type “su”.
im using rooted samsung galaxy s plus, and im inside the adb shell su, what is the command to copy application from my computer to my phone?
It’s a PUSH command…..Google it
Hi Lorenz,
I have some problems whit ADB
I use a Windows 7 Home editon PC
* I download and install the android-
sdk_r16-windows and install it
* updates all the aivaible updates
* I conact A Acer Iconia Tablet A500 to
the USB port
* I Windows exploder i can see my Acer
and can copy an delete files from it
* Start command prompt
* Go to the dir platform-tools
* Type the command
C:\Android\android-sdk-windows\platform-tools>adb devices
* daemon not running. starting it now on
port 5037 *
* daemon started successfully *
List of devices attached
BUT I cat no devices attached
* Restarted the acer BUT still no result
* Remarkt the ADB app whit XP
compartibility and always run as
Administrator
BUT Still no succes
Do you have a solotion for this behave
Best regard,
Martin
Hi Martin, I am facing the same problem. Did you find a solution?
Hi
you need to install a software called usbview, run the application and delete the adb drivers, then remove and replug the drvice to your computer, when the computer ask for drivers, point it to your sdk folder, the drivers under your sdk\extras\google\usb_driver
When i type ‘adb shell’ i get:
adb server is out of date. killing…
ADB server didn’t ACK
* failed to start daemon *
error: protocol fault (no status)
Hey i got root acsses, i m using adb prompt, i got SuperUser permission, but i cant delete “vimi.apk”, its on system/secro/app/vimi.apk, gives erro msg, “permission denied” but im using a filemanager with Superuser permission…
i try to change vimi.apk permision on adb but its gives failure msg
can u help me?
nice post really useful
Billions of Thanks for your tips …
anyone heard of this website http://www.unlockscodes.com/. need to unlock my Samsung galaxy
i have accientally change my system settings through build prop afyer rooting my phone but now my phone ‘s display become oversize and some of the buttons and functions are nt able to fit into the screen go be seen…i know i can change the build prop settings once more but the problem is i cant even.see the button to grant superuser request! and im stuck with a phone of oversized display n the call function cant seem to work anymore..please does anyone knows how i can solve this problem? i really need an anseer…
Hi,
You can manually edit the build prob file by downloading it to your computer/pc then upload it to your phone using adb command. Please see the adb command number 5 and 6 in this tutorial.
Hello,
how do i get superuser permision? su doesn’t work
Frits
hi,
How can we connect to mobile using ADB but without using any commands. Is there any way that we run a software or something and we are connected to mobile. We don’t need to type the commands.
I have installed SDK Tools but there is no folder named “platform-tools” so i am unable to find ADB Files. I opened SDK and it shows that Android SDK Tools is installed but i dont know where it is. Already checked in Tools folder but nothing is there. Please advise..
Installing the Android SDK only gets you half of the way. in order to use the ADB command, you must install tools from the Android SDK download manager. Run the application called android in the tools folder of the Android SDK to bring up the graphical user interface to download the software development tools.
hey guys! please help me i’m new and i don’t know much about it but every time when i open adb it opens for few seconds and then is automatically closed. i don’t know why is this happening so please help me to figure this out guys.
How do I do this on a Mac
after typing “adb shell” i am getting $ sign so than i fired “su” command. and it shows me output “su:permission denied”
What to do? plz help
if u solved ur problem please tell me
I think you need to root your android first 🙂
I have experienced that before.
I’m not sure what I’m doing wrong. Perhaps the problem is caused by the fact that a botched root job has already taken place on my phone. I’ve downloaded the sdk, installed the recommended packages with only one issue (the log shows an item saying “stopping adb server failed (code -1)”. Attempting to get to adb through the command prompt simply doesn’t work. I am sure I’m entering the path listed at the top of the sdk manager and all the system says is that my command is not recognizable as a command. I’ve tried changing the path, but when I did that, the sdk started having all sorts of issues installing packages. What’s the next step here? The first root went down with revolutionary and it had no problems with adb, although I’m on a different computer and my phone (by virture of undergoing the botched root) is a different phone. I was attempting to simply do a factory reset and a competent friend suggested that I do the wipe through the sdk, but I just can’t make it work. Should I just go into recovery through the phone, wipe it, then try to re-root it? Btw, when I check on hboot, it shows “s-off” which is supposed to mean that I’m rooted, but htc sense is currently what’s running. It’s some sort of half-rooted limbo. Thanks for taking the time to read all this, I really appreciate it. I’m trying to do all the reading I can, but every tutorial I read leads to a point that the command prompt won’t let me get past.
How do I send commands out /dev/ttyMSM2 from the adb shell? Or can I even do this?
help keep getting
error:closed
Hy Lorenz, I wanna move a file from my PC to my root folder in my android. I type this command :
adb push myfiles /root/
But cmd said : Permission denied
So how can I copy a file to my root folder..?
Thanks 🙂
Try this:
adb push myfiles /root/
Hi dear friend I want to run command prompt in mobile Samsung note 3 pls guide me regards
i have the problem with adb in command prompt… when i type adb shell i got the problem ”error: closed”…
i need this to uninstall the cf3d driver…plz help meh…
am done with every procedure and everything seems to be working properly bt just that i dont know how to issue the remove “”rm”” command on the adb
can you pls help me cos i want to remove a gesture on my android phone
I Need Help Please.
I followed all the step and my phone is rooted but when go to the command prompt and type in
D:\android-sdk-windows\platform-tools it says “Device not ready”.
Im quite new to this and im not sure where i went wrong. Any suggestions?
hello, i am trying to reset the password on my phone. i understand that the command goes this way
adb
adb shell
rm /data/system/password.key
however, it doesnt work. once i get to adb shell, it shows me
“shell@android:/ $”
and when i type in the code, it doesnt work. it shows me
“Permission denied
255!shell@android:/$”
Please help, Thanks.
my friend needed to fill out IRS 1040 – Schedule A recently and saw a great service that hosts a lot of sample forms . If people are requiring IRS 1040 – Schedule A as well , here’s a https://goo.gl/rBQWOI
Hello Lorenz,
I need your help.
Tell me ….How to create adb cmd command list .
Give me cmd code for initialize in CMD list.
Thanks Bro