android-adb shell命令

1 ps 命令:显示瞬间行程 (process)的动态
USER 
      PID    PPID  VSIZE  RSS        WCHAN      PC                NAME
RSS: 占用的记忆体大小(RSS is the total memory actually held in RAM for aprocess. RSS can be misleading, because it reports the total all ofthe shared libraries that the process uses, even though a sharedlibrary is only loaded into memory once regardless of how manyprocesses use it. RSS is not an accurate representation of thememory usage for a single process)
2 kill :kill命令后面跟的参数是pid;
3 To copy a file or directory (recursively) from theemulator or device, use
    adb pull
< remote > < local >  //从手机到pc
  将apk文件复制到/data/app目录下,即为安装该apk
4
To copy a file or directory (recursively) to theemulator or device, use
    adbpush
< local > < remote >
Unlike the install command, which only copies an .apkfile to a specific location, the pull and push commands let you copy arbitrary directories andfiles to any location in an emulator/device instance.
    与install命令区别:只能复制一个apk文件到指定的位置()。而push和pull命令能更让你复制任何文件或者目录到手任何位置。
5 Installing anApplication
      You can useadb to copy an application from your development computer andinstall it on an emulator/device instance.
      adbinstall < path_to_apk >  // 将apk复制到/data/app目录下面
6 cp 复制使命
  cp remote1 remote2 //该命令只能将一个文件从手机中一个位置复制到另外一个位置。不能用于pc与手机端。
7 卸载apk命令
   1 > 在adb shell中执行 pm uninstall packagename;
   2 > 在adb shell下执行 rm  /data/app/相应的文件名
8 pm命令
usage: pm [list|path|install|uninstall]
      pm list packages [-f] [-d] [-e] [-u] [FILTER]
      pm list permission-groups
      pm list permissions [-g] [-f] [-d] [-u] [GROUP]
      pm list instrumentation [-f] [TARGET-PACKAGE]
      pm list features
      pm list libraries
      pm path PACKAGE
      pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f]PATH
      pm uninstall [-k] PACKAGE
      pm clear 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, optionallyonly
those whose package name contains the text inFILTER.  Options:
  -f: see their associated file.
  -d: filter to include disbled packages.
  -e: filter to include enabled packages.
  -u: also include uninstalled packages.

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 willsee.

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 apackage to the system.  Options:
  -l: installthe package with FORWARD_LOCK.
  -r:reinstall an exisiting app, keeping its data.
  -t: allowtest .apks to be installed.
  -i: specifythe installer package name.
  -s: installpackage on sdcard.
  -f: installpackage on internal flash.

The uninstall command removes a package from the system.Options:
  -k: keep the data and cache directoriesaround.
after the package removal.

The clear command deletes all data associated with a package.

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 installlocation
  0 [auto]: Let system decide the bestlocation
  1 [internal]: Install on internal devicestorage
  2 [external]: Install on external media

The setInstallLocation command changes the default installlocation
  0 [auto]: Let system decide the bestlocation
  1 [internal]: Install on internal devicestorage
  2 [external]: Install on external media

9 am命令
am
usage: am [subcommand] [options]

    start anActivity: am start [-D] [-W]<INTENT>
       -D: enable debugging
       -W: wait for launch to complete

    start aService: am startservice<INTENT>

    send abroadcast Intent: am broadcast <INTENT>

    start anInstrumentation: am instrument [flags]<COMPONENT>
       -r: print raw results (otherwise decodeREPORT_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

    startprofiling: am profile <PROCESS> start<FILE>
    stopprofiling: am profile <PROCESS>stop

    startmonitoring: am monitor [--gdb<port>]
       --gdb: start gdbserv on the given port at crash/ANR

   <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>]
  如:
  1》拨打一个电话 (
[-a<ACTION>] [-d<DATA_URI>] [-t<MIME_TYPE>])使用
           am start -a android.intent.action.CALL -dtel:10086
                      这里-a表示动作,-d表述传入的数据,还有-t表示传入的类型
  2》打开一个网页
          am start -aandroid.intent.action.VIEW -d  http://www.baidu.com
  3》 启动一个服务
    
am startservice<INTENT>
        am startservice -ncom.android.music/com.android.music.MediaPlaybackService
   (这里-n表示组件)

  4》发送广播
    am broadcast -aandroid.intent.action.BOOT_COMPLETED

你可能感兴趣的:(list,command,include,permissions,installer,returning)