1. There are not many Linux commands supported by Android, which can be found under/system/bin. Most of them are Android tools, and only a small part is the original Linux commands.
2. Some commonly used Android commands (Here we only summarize the special android commands, and there are a lot of other Linux Command materials)
A) getprop/watchprops
Getprop lists system attributes. The first ten names are 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]: []
Watchprosp dynamically monitors the changes of these attributes. For example, if I change the system language to Chinese, the following output is displayed:
# Watchprops
Watchprops
1269420653 persist. SYS. Language = 'zh'
1269420653 persist. SYS. Language = 'cn'
B) Wipe <system | data | all>
Wipe indicates clearing the data on the simulator or on the real machine. For example, if your simulator has been used for a long time, you can use it to clear a lot of software installed.
System indicates clearing data under/System
Data indicates clearing data under/Data
C) AM
Usage: am [subcommand] [Options]
Start an activity: am start [-D] <intent>
-D: Enable debugging
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 ] [-T <mime_type>]
[-C <Category> [-C <Category>]...]
[-E | -- es <extra_key> <extra_string_value>...]
[-- EZ <extra_key> <extra_boolean_value>...]
[-E | -- EI <extra_key> <extra_int_value>...]
[-N <component>] [-F <flags>] [<URI>]
Am is a tool for activity management. It has four main usage methods.
Am start/stop <intent> indicates to start or stop an activity. The intent parameter can be found in intent-filter in androidmanifest. xml.
For example, if you want to open the email sending activity, you can write it like this.
# Am start-A Android. Intent. Action. send_multiple
The am start and startactivity methods have the following functions:
Am can also send a broadcast, and the intent behind it is the same as the previous one.
In addition, you can also start profiling and instrumentation, which are not available yet.
D) PM
PM is the package manager. You can include the following parameters. I will not explain it because the help is clear.
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] path
PM uninstall [-K] package
PM enable package_or_component
PM disable package_or_component
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 installa 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.
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
A given package or component (written as "package/class ").
E) SVC
SVC can be used to manage WiFi, power, and data
SVC [WiFi | data | power] [Option]
Usage: SVC WiFi [enable | disable]
Turn on or off WiFi
Usage: SVC power stayon [true | false | USB | Ac]
True: the power supply remains in the stay on state,
Stay on is maintained only when USB is plugged in.
AC charging
F) bootanimation
Displays the boot animation, which can be used for debugging when the default boot animation is replaced.
G) getevent & sendevent
Getevent monitors current events, mouse events, button events, drag and slide events, etc.
# Getevent
Getevent
Add device 1:/dev/input/event0
Name: "qwerty2"
/Dev/input/event0: 0001 001e 00000001
/Dev/input/event0: 0001 001e 00000000
Where/dev/input/event0 is the device name 0001 is type, 001e is the key code, and the last one varies according to the type
For example, the last one is to press the keydown of key A, and the last one is to press the keyup of key.
The specific definitions of type, code, and value can be found in the source code/frameworks/base/CORE/Java/Android/View/keyevent. java.
Sendevent sending time. The format is the same as above. Note that in get, the code is displayed in hexadecimal notation, while in send, the value must be in decimal notation. For example:
# Sendevent/dev/input/event0 1 5 1
This command is used to send the keydown message of number 4, so many 4 messages are printed on the screen (because keyup is not sent)
H) A common Print message command
Dumpsy
Dumpstate
Logcat
Dmesg
These commands are integrated into ddms, so few commands are usually used.
3. There are still a lot of commands that you don't know how to use. Continue to study and update them later.