Basic adb/shell commands for noobs

1,147 posts
Thanks Meter: 82
By brandenk, Senior Member on 22nd May 2009, 08:11 PM
Post Reply Email Thread
Here is a list of some of the adb and terminal command I have used it Android frequently. I found that I was always having to look up these commands so I figured I would start keeping track of the common ones in case they can help anyone else. If any of these needs corrections or if you have a good one to add please post it.

Note, I type "cd C:\Android" to get to my Android folder before doing these commands in the command prompt in windows. That way when I do things like pull apps they end up in "C:\Android\apps", same thing if I want to send I file to my phone I throw it in my Android folder and send it to the phone from there.

Through ADB

Pull apps off phone onto computer
adb pull /system/sd/app app
adb pull /system/sd/app-private app-private
Push apps back to phone from the computer
adb push app /system/sd/app
adb push app-private /system/sd/app-private
Delete existing apps on SD
adb shell rm -r /system/sd/app
adb shell rm -r /system/sd/app-private

Through Terminal

Partition SD card - This erases everything on your SD card (*size* being the size of the FAT32 partition)
$  su
# cd /data
# wget
# chmod 555 sdsplit
# /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)

From the Recovery Screen

Sending an update file to your SD card:
adb shell mount /sdcard
adb shell rm /sdcard/
adb push *filename* /sdcard/

From Fastboot

Restoring a nandroid backup - Start command-prompt/terminal cd to the nandroid folder and enter following commands
fastboot erase boot
fastboot erase recovery
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash userdata data.img
fastboot flash recovery recovery.img
fastboot reboot
The Following 48 Users Say Thank You to brandenk For This Useful Post: [ View ] Gift brandenk Ad-Free
17th June 2009, 09:06 PM |#2  
youngstacks74's Avatar
Senior Member
Thanks Meter: 5
ok after i get adb workin i do the commands like this?

cd C:\Android adb pull /system/sd/app app

and if i wanna push em back i do

C:\Android adb push app /system/sd/app
17th June 2009, 09:14 PM |#3  
DVS_Sokar's Avatar
Senior Member
Flag Sacramento,CA
Thanks Meter: 153
Donate to Me
ADB for dummies Thread covers this.
17th June 2009, 09:18 PM |#4  
NeoBlade's Avatar
Senior Member
Thanks Meter: 81
Nice list of commands, however you *might* want to remove the command to backup private apps ^_-

Also for those who are lazier to copy and paste, you can create .bat files which you can run under Windows and it will automatically run the commands within. Simply copy and paste the commands you want to run into Notepad. Save it with a suitable name but ending with .bat, for example - Restore All Apps.bat

It will now be changed into a batch command file so you can run it by double clicking.

I use a slightly different method where I can put the BAT file anywhere and instead of typing "cd C:\Android" to specify a directory, I just hold down SHIFT then double click on the bat command.

By holding down SHIFT before opening the bat file, it basically tells Windows to open the command prompt within the folder it resides in. Just another shortcut to cut down on commands :P

I suppose you could edit the .bat script further by specifying at the start what directory you want to work with before using the adb commands. You can also make it fancy by adding a menu etc etc.

EDIT: Last time I looked at ADB for dummies, the first post only illustrated how to get ADB working but it didn't actually have any useful commands to use at a glance.
The Following 6 Users Say Thank You to NeoBlade For This Useful Post: [ View ] Gift NeoBlade Ad-Free
17th June 2009, 09:55 PM |#5  
youngstacks74's Avatar
Senior Member
Thanks Meter: 5
just read everypage in the adb for dummies and i still dont know how to pull apps and cache to a certain folder and push them back to a new sd card
The Following User Says Thank You to youngstacks74 For This Useful Post: [ View ] Gift youngstacks74 Ad-Free
30th September 2009, 05:02 PM |#6  
Junior Member
Thanks Meter: 0
how i resolve permission denied error in ADB Shell ??

it doesnt let me do a thing ! googled alot . couldnt find anything helpful

any idea?
30th September 2009, 05:29 PM |#7  
brandenk's Avatar
OP Senior Member
Flag San Diego
Thanks Meter: 82
Are you using a development SPL like Cyanogen's Recovery 1.4?
30th September 2009, 06:17 PM |#8  
Junior Member
Thanks Meter: 0
Originally Posted by brandenk

Are you using a development SPL like Cyanogen's Recovery 1.4?

i have installed [Recovery] [16-Sept-2009] [RA-HERO-v1.2.2] via HTC SYNC . coudlnt installed it via ADB shell . permission denied error .
12th November 2009, 02:16 AM |#9  
TainT's Avatar
Senior Member
Flag A Desert ShitHole
Thanks Meter: 5
anyone know why this wouldnt work with an old school usb 1.0 setup??
just wondered if the retard sammich i had this morning is kicking my ass or if im engaging in an act of futility??
Just doesnt seem right id have to walk all the way upstairs to use a lappy when the office setup would work just fine. No matter how much slower windows could possibly get :sarcasm:

Any consideration this plea gets will be appreciated by less posts and more reading :thumbsup:
12th November 2009, 02:24 AM |#10  
Senior Member
Thanks Meter: 19
Maybe some commands on how to navigate the phone. I'm a DOS guy and the commands are similar

"dir" is "ls" for when you want a list of files and sub-directories in the current directory

"cd\" is is just "cd " (cd[space]) for changing the directory

returning to the previous directory is "cd .."

"del" is "rm" for deleting files (caution).

That's all I can think of right now.
The Following 2 Users Say Thank You to Pinesal For This Useful Post: [ View ] Gift Pinesal Ad-Free
18th November 2009, 05:12 PM |#11  
Junior Member
Thanks Meter: 0
ok I was going to go swap to a Moment today...not anymore. I'll be back after drinking a pot of coffee, theres a TON of info here. Thanks guys...lots of work put in by many. Its appreciated!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes