android adb shell

http://www.cnblogs.com/acpb/archive/2011/05/24/2056026.html


1. 显示系统中全部Android平台:

    android list targets

2. 显示系统中全部AVD(模拟器):

    android list avd

3. 创建AVD(模拟器):

    android create avd --name 名称 --target 平台编号

4. 启动模拟器:

    emulator -avd 名称 -sdcard ~/名称.img (-skin 1280x800)

5. 删除AVD(模拟器):

    android delete avd --name 名称

6. 创建SDCard:

    mksdcard 1024M ~/名称.img

7. AVD(模拟器)所在位置:

    Linux(~/.android/avd)      Windows(C:\Documents and Settings\Administrator\.android\avd)

8. 启动DDMS:

    ddms

9. 显示当前运行的全部模拟器:

    adb devices

10. 对某一模拟器执行命令:

      abd -s 模拟器编号 命令

11. 安装应用程序:

      adb install -r 应用程序.apk

12. 获取模拟器中的文件:

      adb pull <remote> <local>

13. 向模拟器中写文件:

      adb push <local> <remote>

14. 进入模拟器的shell模式:

      adb shell

15. 启动SDK,文档,实例下载管理器:

      android

16. 缷载apk包:

      adb shell

      cd data/app

      rm apk包

      exit

      adb uninstall apk包的主包名

      adb install -r apk包

17. 查看adb命令帮助信息:

      adb help

18. 在命令行中查看LOG信息:

      adb logcat -s 标签名

19. adb shell后面跟的命令主要来自:

      源码\system\core\toolbox目录和源码\frameworks\base\cmds目录。

20. 删除系统应用:

      adb remount (重新挂载系统分区,使系统分区重新可写)。

      adb shell

      cd system/app

      rm *.apk

21. 获取管理员权限:

      adb root

22. 启动Activity:

      adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据,等)。

23、发布端口:

    你可以设置任意的端口号,做为主机向模拟器或设备的请求端口。如: 
adb forward tcp:5555 tcp:8000

24、复制文件:

    你可向一个设备或从一个设备中复制文件, 
     复制一个文件或目录到设备或模拟器上: 
  adb push <source> <destination></destination></source> 
      如:adb push test.txt /tmp/test.txt 
     从设备或模拟器上复制一个文件或目录: 
     adb pull <source> <destination></destination></source> 
     如:adb pull /addroid/lib/libwebcore.so .

25、搜索模拟器/设备的实例:

     取得当前运行的模拟器/设备的实例的列表及每个实例的状态: 
    adb devices

26、查看bug报告: 
adb bugreport 
27、记录无线通讯日志:

    一般来说,无线通讯的日志非常多,在运行时没必要去记录,但我们还是可以通过命令,设置记录: 
    adb shell 
    logcat -b radio

28、获取设备的ID和序列号:

     adb get-product 
     adb get-serialno

29、访问数据库SQLite3

     adb shell 
     sqlite3

#cd system/sd/data //进入系统内指定文件夹 
#ls //列表显示当前文件夹内容 
#rm -r xxx //删除名字为xxx的文件夹及其里面的所有文件 
#rm xxx //删除文件xxx 
#rmdir xxx //删除xxx的文件夹



===============================================================


ADB Shell Command Reference


http://en.androidwiki.com/wiki/ADB_Shell_Command_Reference

akmd: no response, system hangs up using connectbot v1.7.1, logged in as local
$ am [subcommand] [options]
 
   start an Activity: am start [-D] [-W] <INTENT>
       -D: enable debugging
       -W: wait for launch to complete
 
   start a Service: am startservice <INTENT>
 
   send a broadcast Intent: am broadcast <INTENT>
 
   start an Instrumentation: am instrument [flags] <COMPONENT>
       -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
       -e <NAME> <VALUE>: set argument <NAME> to <VALUE>
       -p <FILE>: write profiling data to <FILE>
       -w: wait for instrumentation to finish before returning
 
   start profiling: am profile <PROCESS> start <FILE>
   stop profiling: am profile <PROCESS> stop
 
   <INTENT> specifications include these flags:
       [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
       [-c <CATEGORY> [-c <CATEGORY>] ...]
       [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
       [--esn <EXTRA_KEY> ...]
       [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
       [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
       [-n <COMPONENT>] [-f <FLAGS>]
       [--grant-read-uri-permission] [--grant-write-uri-permission]
       [--debug-log-resolution]
       [--activity-brought-to-front] [--activity-clear-top]
       [--activity-clear-when-task-reset] [--activity-exclude-from-recents]
       [--activity-launched-from-history] [--activity-multiple-task]
       [--activity-no-animation] [--activity-no-history]
       [--activity-no-user-action] [--activity-previous-is-top]
       [--activity-reorder-to-front] [--activity-reset-task-if-needed]
       [--activity-single-top]
       [--receiver-registered-only] [--receiver-replace-pending]
       [<URI>]
app_process
cat
$ chmod <MODE> <FILE>
$ cmp Usage: cmp [-b] [-l] [-n count] file1 file2
dalvikvm $ dalvikvm Dalvik VM requires a class name
$ date -s yyyyMMdd.HHmmss
$ dbus-daemon
No configuration file specified.
dbus-daemon [--version] [--session] [--system] [--config-file=FILE] [--print-add
ress[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect
dd
debug_tool
debuggerd
$ dexopt Usage: don't use this
$ df output 
/dev: 319124K total, 0K used, 319124K available (block size 4096)
/system: 558668K total, 398176K used, 160492K available (block size 4096)
/data: 1178068K total, 259136K used, 918932K available (block size 4096)
/cache: 294628K total, 42992K used, 251636K available (block size 4096)
/devlog: 21100K total, 15980K used, 5120K available (block size 4096)
/mnt/asec: 319124K total, 0K used, 319124K available (block size 4096)
/app-cache: 8192K total, 5540K used, 2652K available (block size 4096)
/mnt/sdcard: 7763968K total, 277088K used, 7486880K available (block size 32768)
/mnt/secure/asec: Permission denied
/mnt/asec/com.RunnerGames.game.YooNinja_Lite-1: 6236K total, 5012K used, 1224K a
vailable (block size 4096)
/mnt/asec/com.glu.android.gunbros_free-1: 4164K total, 2104K used, 2060K availab
le (block size 4096)
dhcpcd 
dmesg
dumpcrash
dumpstate
dumpsys
dvz
fillup
flash_image
getevent
getprop
hciattach
hcid
$ hd usage: hd [-b base] [-c coun] [-r delay] file
hostapd
hostapd_cli
htclogkernel
id
ifconfig
iftop
$ input usage: input [text|keyevent]
       input text <string>
       input keyevent <event_code>
id
$ insmod usage: insmod <module.o>
installd
ioctl
itr
kill
linker
ln
$ log USAGE: log [-p priorityChar] [-t tag] me
ssage priorityChar should be one of: v,d,i,w,e
logcat
logwrapper
ls
lsmod
mediaserver
mkdir
mkdosfs
mount
$ monkey usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
             [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
             [--ignore-crashes] [--ignore-timeouts]
             [--ignore-security-exceptions]
             [--monitor-native-crashes] [--ignore-native-crashes]
             [--kill-process-after-error] [--hprof]
             [--pct-touch PERCENT] [--pct-motion PERCENT]
             [--pct-trackball PERCENT] [--pct-syskeys PERCENT]
             [--pct-nav PERCENT] [--pct-majornav PERCENT]
             [--pct-appswitch PERCENT] [--pct-flip PERCENT]
             [--pct-anyevent PERCENT]
             [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
             [--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
             [--wait-dbg] [--dbg-no-events]
             [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
             [--port port]
             [-s SEED] [-v [-v] ...]
             [--throttle MILLISEC] [--randomize-throttle]
             COUNT
mountd
$ mv USAGE: mv <source...> <destination>
netcfg
netstat 
$ notify Usage: notify [-m eventmask] [-c count] [-p] [-v verbosity] path [path ...]
ping
playmp3
$ pm usage: pm [list|path|install|uninstall]
       pm list packages [-f]
       pm list permission-groups
       pm list permissions [-g] [-f] [-d] [-u] [GROUP]
       pm list instrumentation [-f] [TARGET-PACKAGE]
       pm list features
       pm path PACKAGE
       pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH
       pm uninstall [-k] PACKAGE
       pm enable PACKAGE_OR_COMPONENT
       pm disable PACKAGE_OR_COMPONENT
       pm setInstallLocation [0/auto] [1/internal] [2/external]
 
The list packages command prints all packages.  Options:
  -f: see their associated file.
 
The list permission-groups command prints all known
permission groups.
 
The list permissions command prints all known
permissions, optionally only those in GROUP.  Options:
  -g: organize by group.
  -f: print all information.
  -s: short summary.
  -d: only list dangerous permissions.
  -u: list only the permissions users will see.
 
The list instrumentation command prints all instrumentations,
or only those that target a specified package.  Options:
  -f: see their associated file.
 
The list features command prints all features of the system.
 
The path command prints the path to the .apk of a package.
 
The install command installs a package to the system.  Options:
  -l: install the package with FORWARD_LOCK.
  -r: reinstall an exisiting app, keeping its data.
  -t: allow test .apks to be installed.
  -i: specify the installer package name.
  -s: install package on sdcard.
  -f: install package on internal flash.
 
The uninstall command removes a package from the system. Options:
  -k: keep the data and cache directories around.
after the package removal.
 
The enable and disable commands change the enabled state of
a given package or component (written as "package/class").
 
The getInstallLocation command gets the current install location
  0 [auto]: Let system decide the best location
  1 [internal]: Install on internal device storage
  2 [external]: Install on external media
 
The setInstallLocation command changes the default install location
  0 [auto]: Let system decide the best location
  1 [internal]: Install on internal device storage
  2 [external]: Install on external media
printenv
ps
$ qemudqemud: permission denied
$ radiooptions
Usage: radiooptions [option] [extra_socket_args]
           0 - RADIO_RESET,
           1 - RADIO_OFF,
           2 - UNSOL_NETWORK_STATE_CHANGE,
           3 - QXDM_ENABLE,
           4 - QXDM_DISABLE,
           5 - RADIO_ON,
           6 apn- SETUP_PDP apn,
           7 - DEACTIVE_PDP,
           8 number - DIAL_CALL number,
           9 - ANSWER_CALL,
           10 - END_CALL
           11 rsp -  FAKE_UNSOL
           12 num_of_rsp rsp -  FAKE_UNSOL_EXT,
           13 command - UNIAT,
: Unknown error: 0
reboot
renice
rild
rm
rmdir
rmmod
route
schedtop
sdptool
sdutil
sendevent
service
servicemanager
setconsole
setprop
sh
sleep
smd
ssltest
start
stop
surfaceflinger
svc
sync
system_server
telnetd
toolbox
top
umount
vmstat
watchprops
wipe
wlan_loader
wpa_cli
wpa_supplicant


你可能感兴趣的:(android adb shell)