Basic ADB Functions -

Search This thread

Mjamocha

Senior Member
Jul 2, 2010
1,256
765
Basic Commands :
++++++++++++++++++++++++++++
Following are the basic commands which we usually use :

pull - to copy file/dir from Xoom to computer
push - to copy file/dir from computer to Xoom , we will call it "X"
delete - delete file/dir from X
install – install apps on X [either on SD Card or internal storage]
reboot - reboot your X

ADB Shell command -
Code:
adb shell
In command prompt, just type
Code:
adb
list of all commands will show up.

Examples :
++++++++++++++++++++++++++++
The following command, (pull) takes the file avi.apk from the device and saves it as file.apk to the Android Tools directory of computer.

Pull
Code:
Code:
 adb pull /system/app/avi.apk file.apk
Push
The following command will copy avi.apk file as happy.apk, from the computer Android tools folder to /system/app of the device
Code:
Code:
  adb push avi.apk /system/app/happy.apk
Delete :
The following command removes file avi.apk
Code:
Code:
  adb shell rm /system/app/avi.apk
Install :
adb can also be used to install apks. Place the downloaded apks in C:/ drive. for eg, I have placed angrybirds.apk in C:/ drive of my computer. To install it, just run the following command.


Code:
Code:
 adb install angrybirds.apk
By above command it will install to internal storage.
*You can also install to SD card by -s switch. (example below)

Code:
Code:
adb install -s angrybirds.apk
Reboot :
The following command will reboot your (device)
Code:
Code:
 adb shell su reboot
Quick tips :
++++++++++++++++++++++++++++
1. The commands are case sensitive.
2. Using adb you will be accessing system files, play commands safely or else you might end up making your device unusable.

RENAME : File or APK -
++++++++++++++++++++++++++++

Linux commands. You 'move' the file from the old name to the new one.

Make sure your phone or Tab has enabled USB debugging, connect it to your computer, on your computer type: adb shell


The command you can use is mv (move a file or rename a file)

mv
- renames files, apk ...

Code:
Code:
 [COLOR=Red]mv[/COLOR] filename[COLOR=Red].[/COLOR]old filename[COLOR=Red].[/COLOR]new
(If it's a system file, you'll will have to have superuser permission and have to make the file system read-write.)


Stubborn Folder Removal -
Intro:

++++++++++++++++++++++++++++
rm - remove files or directories

rm Does not work on directories (unless you use -r, but CAREFUL of this command)

rm -rf /foldername
(This is an example)
Code:
[COLOR=Red]rm[/COLOR] [COLOR=Red]-rf[/COLOR] /system/your stubborn folder
This will remove 'stubborn folder' and everything inside that bad boy)

-r = recursive -f = force

if rm -rf complains about the -rf part,

(Try to run):
Code:
 busybox [COLOR=Red]rm -rf[/COLOR] /foldername
IMPORTANT: there is no warning to remove the entire folder, once you hit enter it's gone.

-f can also be used as an alternative

Manual RM: http://unixhelp.ed.ac.uk/CGI/man-cgi?rm

How To:

ADB Shell Removal -
(we will use BT5 as an example)
++++++++++++++++++++++++++++
1. Connect Xoom
2. Boot into recovery
3. Toggle to internal storage as /sdcard
mount /data

Enter adb shell via pc
(cd to file location) in this case BT5, is in the sdcard directory

Code:
cd /sdcard #
(once typed, you will be at.... /data/media prompt)
Code:
rm -r stubborn Folder


*Side note ... This works for any other stubborn folder that you want to delete as well...

USE AT YOU OWN RISK - MAKE SURE YOU DO A BACKUP FIRST

If this was helpful Hit The thanks!
wink.gif
 
Last edited:
Sep 29, 2011
23
0
Kolkata
helpful!!

buddy tell me 1 thing...i need to delete an .apk from system/app/

should i do these:-
1)adb root
2)adb shell
3)adb shell getprop ro.secure
4)adb shell mount -oremount,rw /dev/block/system /system
5)adb delete /system/app/<filename>.apk
6)adb shell mount -oremount,ro /dev/block/system /system

is that it??

or the step 5 should be 5)adb shell rm /system/app/<filename>.apk

please....reply.thanks in advabce....i am a total noob in this case(knows a little bit of programming stuff so the commands seems understandable, copied steps 1-4 and 6 from a rooting device site)thought matching both of them shall do the thing...will it??
 

Mjamocha

Senior Member
Jul 2, 2010
1,256
765
Your best bet since you say that you are unfamiliar with adb commands, is to remove the "apk" via an app named Root Explorer. As long as you are uzing a rooted device it will make any apk available for easy removal. Be Careful.
 
  • Like
Reactions: santy_sayantan
Sep 29, 2011
23
0
Kolkata
I made a mistake

actually I have copied the superuser.apk into system/app/ folder so that it gets automatically installed when i reset the device...and then the problem starts....SUPERUSER stopped responding(getting force closed automatically) and therefore no explorer/titanium backup....nothing is getting root access....so hav to do dis using adb...will hav to delete supeuser 3.1.apk and then reset the device again...

just tell me which step 5 should i use since u have mentioned two ways...
 
Last edited:

Mjamocha

Senior Member
Jul 2, 2010
1,256
765
actually I have copied the superuser.apk into system/app/ folder so hav to do dis using adb...will hav to delete supeuser 3.1.apk and then reset the device again...



First and foremost, Superuser or Supersu MUST be installed in data/app directory otherwise you run into issues.

adb shell rm /system/stubborn.apk

Or (wherever directory you put the .apk)

adb shell rm /system/app/stubborn.apk
 
Last edited:
  • Like
Reactions: santy_sayantan

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Basic Commands :
    ++++++++++++++++++++++++++++
    Following are the basic commands which we usually use :

    pull - to copy file/dir from Xoom to computer
    push - to copy file/dir from computer to Xoom , we will call it "X"
    delete - delete file/dir from X
    install – install apps on X [either on SD Card or internal storage]
    reboot - reboot your X

    ADB Shell command -
    Code:
    adb shell
    In command prompt, just type
    Code:
    adb
    list of all commands will show up.

    Examples :
    ++++++++++++++++++++++++++++
    The following command, (pull) takes the file avi.apk from the device and saves it as file.apk to the Android Tools directory of computer.

    Pull
    Code:
    Code:
     adb pull /system/app/avi.apk file.apk
    Push
    The following command will copy avi.apk file as happy.apk, from the computer Android tools folder to /system/app of the device
    Code:
    Code:
      adb push avi.apk /system/app/happy.apk
    Delete :
    The following command removes file avi.apk
    Code:
    Code:
      adb shell rm /system/app/avi.apk
    Install :
    adb can also be used to install apks. Place the downloaded apks in C:/ drive. for eg, I have placed angrybirds.apk in C:/ drive of my computer. To install it, just run the following command.


    Code:
    Code:
     adb install angrybirds.apk
    By above command it will install to internal storage.
    *You can also install to SD card by -s switch. (example below)

    Code:
    Code:
    adb install -s angrybirds.apk
    Reboot :
    The following command will reboot your (device)
    Code:
    Code:
     adb shell su reboot
    Quick tips :
    ++++++++++++++++++++++++++++
    1. The commands are case sensitive.
    2. Using adb you will be accessing system files, play commands safely or else you might end up making your device unusable.

    RENAME : File or APK -
    ++++++++++++++++++++++++++++

    Linux commands. You 'move' the file from the old name to the new one.

    Make sure your phone or Tab has enabled USB debugging, connect it to your computer, on your computer type: adb shell


    The command you can use is mv (move a file or rename a file)

    mv
    - renames files, apk ...

    Code:
    Code:
     [COLOR=Red]mv[/COLOR] filename[COLOR=Red].[/COLOR]old filename[COLOR=Red].[/COLOR]new
    (If it's a system file, you'll will have to have superuser permission and have to make the file system read-write.)


    Stubborn Folder Removal -
    Intro:

    ++++++++++++++++++++++++++++
    rm - remove files or directories

    rm Does not work on directories (unless you use -r, but CAREFUL of this command)

    rm -rf /foldername
    (This is an example)
    Code:
    [COLOR=Red]rm[/COLOR] [COLOR=Red]-rf[/COLOR] /system/your stubborn folder
    This will remove 'stubborn folder' and everything inside that bad boy)

    -r = recursive -f = force

    if rm -rf complains about the -rf part,

    (Try to run):
    Code:
     busybox [COLOR=Red]rm -rf[/COLOR] /foldername
    IMPORTANT: there is no warning to remove the entire folder, once you hit enter it's gone.

    -f can also be used as an alternative

    Manual RM: http://unixhelp.ed.ac.uk/CGI/man-cgi?rm

    How To:

    ADB Shell Removal -
    (we will use BT5 as an example)
    ++++++++++++++++++++++++++++
    1. Connect Xoom
    2. Boot into recovery
    3. Toggle to internal storage as /sdcard
    mount /data

    Enter adb shell via pc
    (cd to file location) in this case BT5, is in the sdcard directory

    Code:
    cd /sdcard #
    (once typed, you will be at.... /data/media prompt)
    Code:
    rm -r stubborn Folder


    *Side note ... This works for any other stubborn folder that you want to delete as well...

    USE AT YOU OWN RISK - MAKE SURE YOU DO A BACKUP FIRST

    If this was helpful Hit The thanks!
    wink.gif
    1
    Your best bet since you say that you are unfamiliar with adb commands, is to remove the "apk" via an app named Root Explorer. As long as you are uzing a rooted device it will make any apk available for easy removal. Be Careful.
    1
    actually I have copied the superuser.apk into system/app/ folder so hav to do dis using adb...will hav to delete supeuser 3.1.apk and then reset the device again...



    First and foremost, Superuser or Supersu MUST be installed in data/app directory otherwise you run into issues.

    adb shell rm /system/stubborn.apk

    Or (wherever directory you put the .apk)

    adb shell rm /system/app/stubborn.apk