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
andpush
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> ...]