Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,760 Members 48,399 Now Online
XDA Developers Android and Mobile Development Forum

Basic adb/shell commands for noobs

Tip us?
 
brandenk
Old
(Last edited by brandenk; 1st July 2009 at 10:12 PM.)
#1  
brandenk's Avatar
Senior Member - OP
Thanks Meter 62
Posts: 1,132
Join Date: Aug 2007
Location: San Diego
Default Basic adb/shell commands for noobs

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
Code:
adb pull /system/sd/app app
adb pull /system/sd/app-private app-private
Push apps back to phone from the computer
Code:
adb push app /system/sd/app
adb push app-private /system/sd/app-private
Delete existing apps on SD
Code:
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)
Code:
$  su
# cd /data
# wget http://64.105.21.209/bin/lib/droid/sdsplit
# 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:
Code:
adb shell mount /sdcard
adb shell rm /sdcard/update.zip
adb push *filename* /sdcard/update.zip

From Fastboot

Restoring a nandroid backup - Start command-prompt/terminal cd to the nandroid folder and enter following commands
Code:
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
Nexus 5 ← GS3 ← Evo 3D ← Evo 4G ← Nexus One ← MyTouch ← G1 ← HTC TyTN
Tab 4 7"
The Following 39 Users Say Thank You to brandenk For This Useful Post: [ Click to Expand ]
 
youngstacks74
Old
#2  
youngstacks74's Avatar
Senior Member
Thanks Meter 5
Posts: 164
Join Date: Mar 2008
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
 
DeadPhoenix
Old
#3  
DeadPhoenix's Avatar
Senior Member
Thanks Meter 104
Posts: 296
Join Date: Apr 2009
Location: Sacramento

 
DONATE TO ME
ADB for dummies Thread covers this.
Cell:
Phone: HTC One Max (Verizon)
S-Off: Rumrunner Verizon
Rom: Stock
Recovery: TWRP

Tablet: Nexus 10 16GB Wi-Fi
Memory: 16GB Internal
Rom: Paranoid Android
Recovery: CWM

Retired Devices:
iPhone 5 16GB Black (Verizon) <- Verizon Motorola RAZR HD 16GB <- Verizon Samsung Galaxy SIII Pebble Blue 16GB <- Verizon Galaxy Nexus

 
NeoBlade
Old
#4  
NeoBlade's Avatar
Senior Member
Thanks Meter 80
Posts: 589
Join Date: Jan 2009
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 5 Users Say Thank You to NeoBlade For This Useful Post: [ Click to Expand ]
 
youngstacks74
Old
#5  
youngstacks74's Avatar
Senior Member
Thanks Meter 5
Posts: 164
Join Date: Mar 2008
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: [ Click to Expand ]
 
mecho
Old
#6  
Junior Member
Thanks Meter 0
Posts: 29
Join Date: Sep 2008
how i resolve permission denied error in ADB Shell ??

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

any idea?
 
brandenk
Old
#7  
brandenk's Avatar
Senior Member - OP
Thanks Meter 62
Posts: 1,132
Join Date: Aug 2007
Location: San Diego
Are you using a development SPL like Cyanogen's Recovery 1.4?
Nexus 5 ← GS3 ← Evo 3D ← Evo 4G ← Nexus One ← MyTouch ← G1 ← HTC TyTN
Tab 4 7"
 
mecho
Old
#8  
Junior Member
Thanks Meter 0
Posts: 29
Join Date: Sep 2008
Quote:
Originally Posted by brandenk View Post
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 .
 
TainT
Old
#9  
TainT's Avatar
Senior Member
Thanks Meter 5
Posts: 147
Join Date: Aug 2007
Location: A Desert ShitHole
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:
 
Pinesal
Old
#10  
Senior Member
Thanks Meter 19
Posts: 503
Join Date: Jan 2009
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: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes