android adb shell 命令集及常用命令用法

# pwd
/
# ls
acct                   init.goldfish.rc       sd-ext
cache                  init.mapphone_umts.rc  sdcard
config                 init.rc                sys
d                      init_prep_keypad.sh    system
data                   mnt                    tmp
default.prop           pds                    ueventd.rc
dev                    proc                   vendor
etc                    root
init                   sbin
# echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
# ls sbin
adbd       adbd.root  ueventd
# ls vendor/bin
ls: vendor/bin: No such file or directory
# ls -al
drwxr-xr-x   16 root     root             0 Nov 15 11:44 .
drwxr-xr-x   16 root     root             0 Nov 15 11:44 ..
drwxr-xr-x    3 root     root             0 Nov 15 11:44 acct
drwxrwx--x    6 system   cache         1024 Oct 27 16:38 cache
dr-x------    2 root     root             0 Nov 15 11:44 config
lrwxrwxrwx    1 root     root            17 Nov 15 11:44 d -> /sys/kernel/debug
drwxrwx--x   25 system   system        4096 Nov  6 09:16 data
-rwxr-xr-x    1 root     root           287 Nov 15 11:44 default.prop
drwxr-xr-x   11 root     root          2600 Nov 15 11:44 dev
lrwxrwxrwx    1 root     root            11 Nov 15 11:44 etc -> /system/etc
-rwxr-xr-x    1 root     root         94372 Nov 15 11:44 init
-rwxr-xr-x    1 root     root          1677 Nov 15 11:44 init.goldfish.rc
-rwxr-xr-x    1 root     root         11151 Nov 15 11:44 init.mapphone_umts.rc
-rwxr-xr-x    1 root     root         15064 Nov 15 11:44 init.rc
-rwxr-x---    1 root     root           453 Jan  1  1970 init_prep_keypad.sh
drwxrwxr-x    6 root     system           0 Nov 15 11:44 mnt
drwxrwxr-x   11 system   system        1024 Jan  1  1970 pds
dr-xr-xr-x  160 root     root             0 Jan  1  1970 proc
drwx------    2 root     root             0 Mar 24  2011 root
drwxr-xr-x    2 root     root             0 Nov 15 11:44 sbin
drwxrwx--x    2 system   system           0 Nov 15 11:44 sd-ext
lrwxrwxrwx    1 root     root            11 Nov 15 11:44 sdcard -> /mnt/sdcard
drwxr-xr-x   14 root     root             0 Jan  1  1970 sys
drwxr-xr-x   14 root     root          1024 Oct 27 16:33 system
drwxrwxrwt    3 root     root           220 Nov 15 11:45 tmp
-rwxr-xr-x    1 root     root          7165 Nov 15 11:44 ueventd.rc
lrwxrwxrwx    1 root     root            14 Nov 15 11:44 vendor -> /system/vendor
# ls system/sbin
ls: system/sbin: No such file or directory
# ls system/bin
akmd2             getevent          netstat           setprop
am                getprop           newfs_msdos       sh
ap_gain.bin       gkisystem         notify            showlease
ap_gain_mmul.bin  gzip              nvm_daemon        sleep
app_process       hciattach         omx_tests         smd
applypatch        hd                opprofdaemon      ssmgrd
audioloop         hostap            pand              stagefright
battd             id                ping              start
bluetoothd        ifconfig          pm                stop
bmgr              iftop             pppd              surfaceflinger
bootanimation     ime               printenv          svc
bootmenu          input             protocol_driver   sync
brcm_guci_drv     insmod            ps                sysinit
bugreport         installd          pvrsrvinit        system_server
cat               ioctl             qemu-props        tc
charge_only_mode  ionice            qemud             testid3
cmp               iptables          racoon            tiap_cu
dalvikvm          keystore          radiooptions      tiap_loader
date              keystore_cli      reboot            toolbox
dbus-daemon       kill              record            top
dd                linker            renice            tune2fs
debuggerd         location          rild              unyaffs
dexopt            log               rmdir             uptime
dhcpcd            logcat            rmmod             usbd
dmesg             logwrapper        route             vdc
dnsmasq           logwrapper.bin    rtp_test          vmstat
dspexec           lsmod             run-as            vold
dumpstate         mediaserver       schedtest         watchprops
dumpsys           mkyaffs2image     schedtop          wipe
dvz               monkey            screencap         wlan_cu
e2fsck            mot_boot_mode     sdcard            wlan_loader
fix_permissions   mtpd              sdptool           wpa_cli
fmradio           nandread          sendevent         wpa_supplicant
fmradioserver     ndc               service
fsck_msdos        netcfg            servicemanager
gdbserver         netd              setconsole

# ls system/xbin
[                 fgrep             mount             sleep
[[                find              mountpoint        sort
add-property-tag  flash_lock        mpstat            split
amonraota         flash_unlock      mv                sqlite3
apply_firewall    flashcp           mv2sd             stat
apply_theme       flock             nanddump          strace
arp               fold              nandwrite         strings
ash               free              netstat           stty
awk               freeramdisk       nice              su
base64            fsync             nohup             sum
basename          ftpget            nslookup          swapoff
bbconfig          ftpput            ntpd              swapon
blockdev          fuser             od                sync
brctl             getopt            opcontrol         sysctl
btool             grep              openvpn           tac
bunzip2           groups            openvpn-up.sh     tail
busybox           gunzip            oprofiled         tar
bzcat             gzip              ota               tee
bzip2             halt              patch             telnet
cal               hcidump           pgrep             telnetd
cat               head              pidof             test
catv              hexdump           ping              tftp
chattr            id                pkill             tftpd
check-lost+found  ifconfig          pmap              time
chgrp             insmod            poweroff          timeout
chmod             install           printenv          top
chown             iostat            printf            touch
chroot            ip                procmem           tr
clear             kill              procrank          traceroute
cmp               killall           ps                true
comm              killall5          pstree            ttysize
cp                latencytop        pwd               tune2fs
cpio              length            pwdx              twrpota
crond             less              rawbu             umount
crontab           librank           rdev              uname
cut               ln                readlink          uncompress
cwmota            losetup           realpath          unexpand
date              ls                renice            uniq
dc                lsattr            reset             unix2dos
dd                lsmod             resize            unlzma
depmod            lsusb             rev               unlzop
devmem            lzcat             rm                unxz
dexdump           lzma              rmdir             unzip
df                lzop              rmmod             uptime
diff              lzopcat           route             usleep
dirname           man               run-parts         uudecode
dmesg             md5sum            rx                uuencode
dnsd              mesg              scp               vi
dos2unix          mkdir             sed               watch
du                mke2fs            seq               wc
dumplog           mkfifo            setconsole        wget
echo              mkfs.ext2         setserial         which
ed                mkfs.vfat         setsid            whoami
egrep             mknod             sh                xargs
env               mkswap            sha1sum           xz
expand            mktemp            sha256sum         xzcat
expr              modinfo           sha512sum         yes
false             modprobe          showmap           zcat
fdisk             more              showslab

下面列举 部分命令用法:

1、am: (在 push 进新apk 时,需要重新启动服务,或 activity)

# am
usage: 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

    start monitoring: 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>]

2、logcat

# logcat --help
Usage: logcat [options] [filterspecs]
options include:
  -s              Set default filter to silent.
                  Like specifying filterspec '*:s'
  -f <filename>   Log to file. Default to stdout
  -r [<kbytes>]   Rotate log every kbytes. (16 if unspecified). Requires -f
  -n <count>      Sets max number of rotated logs to <count>, default 4
  -v <format>     Sets the log print format, where <format> is one of:

                  brief process tag thread raw time threadtime long

  -c              clear (flush) the entire log and exit
  -d              dump the log and then exit (don't block)
  -t <count>      print only the most recent <count> lines (implies -d)
  -g              get the size of the log's ring buffer and exit
  -b <buffer>     request alternate ring buffer
                  ('main' (default), 'radio', 'events')
  -B              output the log in binary
  -C              colored output
filterspecs are a series of
  <tag>[:priority]

where <tag> is a log component tag (or * for all) and priority is:
  V    Verbose
  D    Debug
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (supress all output)

'*' means '*:d' and <tag> by itself means <tag>:v

If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
If no filterspec is found, filter defaults to '*:I'

If not specified with -v, format is set from ANDROID_PRINTF_LOG
or defaults to "brief"

3、monkey

# 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]
              [--profile-wait MILLISEC]
              [--device-sleep-time MILLISEC]
              [--randomize-script]
              [--script-log]
              [--bugreport]
              COUNT

4、input  (开发人员的利器,需要经常输入邮箱、密码,或网址 较长字符时,特别好用)

# input
usage: input [text|keyevent]
       input text <string>
       input keyevent <event_code>


待叙……





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值