"Android"--adb shell command exploration

Source: Internet
Author: User

What the ADB is, do not know about Android development.

Run cmd under window and enter ADB help to print what ADB can do, including ADB push. ADB Pull: ADB devices adb install ... Wait a minute.. And a lot of searching.


One of the commands called the ADB shell,android is Linux-based, and in Shell mode Linux commands are very large, and Android has removed many Linux commands, so what treasures can be found in this command? Treasure Hunt opens!!


First of all, the Linux shell mode has many commands, such as LS CD mkdir su PS vim and many other control commands, which are supported on Android. But it is the Android kernel, ah, there should be some special point of it.


Go to the Bin directory by command Cd/system/bin to view it.


# cd/system/bincd/system/bin# Lslsblobcache_testinputchannel_testinputdispatcher_testinputevent_ Testinputpublisherandconsinputreader_testlooper_testobbfile_teststring8_testunicode_testzipfilero_testadbamapp _processapplypatchapplypatch_staticashaudioloopbmgrbootanimationbubugreportcatcheck_ Prereqchmodchowncmpdalvikvmdatedddebuggerddecoderdexoptdfdhcpcddmesgdumpstatedumpsysflash_imagefsck_ Msdosgdbjithelpergdbservergeteventgetpropgziphdidifconfigiftopimeinputinsmodinstalldioctlioniceip6tablesiptableskeystorek Eystore_ Clikilllinkerlnloglogcatlogwrapperlslsmodlsofmediaservermkdirmonkeymountmtpdmvnandreadndcnetcfgnetdnetstatnewfs _msdosnotifyomx_ Testspingping6pmpppdprintenvpsqemu-propsqemudrracoonradiooptionsrebootrecordrecordvideorecoveryrenicerildrmrmdirrmmodrout Erun-asschedtestschedtopscreencapscreenshotsdcardsendeventsensorserviceserviceservicemanagersetconsolesetpropsf2shshowlea Sesimg2imgskia_testsleepsmdstagefrightstartstopstreamsurfaceflingersvcsyncsystem_servertestid3toolboxtoptouchumountupdateruptimevdcvmstatvoldwatchpropswipe# 

Oh my god command is still a lot of!

We can generally view the introduction by command-H, for example:

# am-ham-husage:am [subcommand] [options]usage:am start [-d] [-W] [-P <file>] [--start-profiler <file>] [--r COUNT]        [-S] <INTENT> am startservice <INTENT> am force-stop <PACKAGE> am Kill <PACKAGE> AM Kill-all AM Broadcast <INTENT> AM instrument [-r] [-e <NAME> <value>] [-P <file [-W] [--no-window-animation] <COMPONENT> AM profile [looper] Start <PROCESS> <fil e> am Profile [looper] stop [<process>] am dumpheap [flags] <PROCESS> <FILE> AM Set -debug-app [-W] [--persistent] <PACKAGE> AM clear-debug-app am Monitor [--gdb <port>] am SCR Een-compat [On|off] <PACKAGE> am Display-size [reset|  MxN] am To-uri [INTENT] am To-intent-uri [intent]am start:start an Activity. Options is:-d:enable debugging-w: Wait for launch to complete--start-profiLer <file>: Start Profiler and send results to <FILE>-P <file>: Like above, but profiling stops when  App goes idle-r: Repeat the activity launch <COUNT> times.    Prior to each repeat, the top activity would be finished. -s:force Stop the target app before starting the Activityam Startservice:start a service.am force-stop:force stop every  Thing associated with <package>.am Kill:kill all processes associated with <package>.  Only kills. Processes that's safe to kill – that's, won't impact the user experience.am Kill-all:kill all background Processe  S.am broadcast:send A broadcast intent.am Instrument:start an instrumentation.  Typically this target <COMPONENT> is the form <test_package>/<runner_class>.  Options are:-r:print raw results (otherwise decode report_key_streamresult).    Use with [-e perf true] to generate raw output for performance measurements. -e <NAME> <value>: Set Argument <NAME> to <value>.    For test runners a common form is [-e <testrunner_flag> <value>[,<value> ...].  -P <file>: Write profiling data to <FILE>-w:wait for instrumentation to finish before returning.    Required for Test runners. --no-window-animation:turn off window animations'll running.am Profile:start and stop Profiler on a process.am Dumphea  P:dump the heap of a process.  Options is:-n:dump native heap instead of managed Heapam set-debug-app:set application <PACKAGE> to debug. Options is:-w:wait for debugger While application starts--persistent:retain this valueam clear-debug-app:clear    The previously set-debug-app.am Monitor:start monitoring for crashes or ANRS. --gdb:start Gdbserv on the given port at Crash/anram Screen-compat:control screen compatibility mode of &LT;PACKAGE&GT;. Am display-size:override display size.am To-uri:print the given Intent specification as a uri.am To-intent-uri:print the given intent specification as an intent:uri.<intent> specifications include these flags a nd arguments: [-a <action>] [-D ] [-t <mime_type>] [-C <CATEGORY> [-C <category    ] [...]    [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]    [--esn <EXTRA_KEY> ...]    [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]    [--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]    [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]    [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]    [--eia <EXTRA_KEY> <extra_int_value>[,<extra_int_value ...]    [--ela <EXTRA_KEY> <extra_long_value>[,<extra_long_value ...] [-n <component>]    [-f <flags>] [--grant-read-uri-permission]    [--grant-write-uri-permission] [--debug-log-resolution]    [--exclude-stopped-packages]    [--include-stopped-packages] [--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]    [--activity-clear-task]    [--activity-task-on-home] [--receiver-registered-only]    [--receiver-replace-pending]    [--selector] [<uri> | <PACKAGE> | <component>] Error:unknown Command:-H

Although-H is not recognized, the parameters are still printed.

1, am command is a very useful command, use this command can start activity, services, send broadcast and so on.

Use instances: such as starting an Activity:

Format: ADB shell am START-N package Name/package name + class name (-N class name,-a action,-d date,-m mime-type,-c category,-e Extended data, etc.).

Instance 1:c:\users\administrator>adb shell am start-n com.android.camera/. camerastarting:intent {cmp=com.android.camera/. Camera}

Example 2: (Intent with extra) c:\users\administrator>adb shell am start-n com.android.camera/. CAMERA-E ABC hellostarting:intent {cmp=com.android.camera/. Camera (has extras)} where extra key is ABC, value is string "Hello"

You can also send commands to simulate mobile low-power environments:

Example: ADB shell am broadcast-a android.intent.action.BATTERY_CHANGED--ei "level" 3--ei "scale" 100

2, Getprop/watchprops

Getprop lists the properties of the system, preceded by 10 names, followed by values
# Getprop
Getprop
[ro.secure]: [0]
[Ro.allow.mock.location]: [1]
[ro.debuggable]: [1]
[persist.service.adb.enable]: [1]
[Ro.kernel.qemu]: [1]
[Ro.kernel.console]: [ttyS0]
[Ro.kernel.android.checkjni]: [1]
[Ro.kernel.android.qemud]: [TtyS1]
[Ro.kernel.android.ndns]: [1]
[ro.factorytest]: [0]
[Ro.serialno]: []

3, WATCHPROSP dynamic monitoring changes in these properties, such as the language I modify the system is Chinese, will print out:
# Watchprops
Watchprops
1269420653 persist.sys.language = ' zh '
1269420653 persist.sys.language = ' CN '

4. Wipe <system|data|all>
wipe means to clear the emulator or the data on the real machine, such as your simulator for a long time, loaded with a lot of software can use this to clear
system indicates that the data under/system is cleared
Data statement clears the/data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.