[Android]把busybox上所有命令映射出来;

方法:打开USB调试,把手机连接电脑,输入以下命令

scue@Link:bootimg$ for n in $(adb shell busybox | sed -n "$[$(adb shell busybox | sed -n '/Currently\ defined\ functions/=')+1],$ p") ; do echo "symlink /sbin/busybox /sbin/$n" | awk -F',' '{print $1}'; done 

相关解释:

1. $(adb shell busybox | sed -n "$[$(adb shell busybox | sed -n '/Currently\ defined\ functions/=')+1],$ p")  得到一个集合;

2. $[$(adb shell busybox | sed -n '/Currently\ defined\ functions/=')+1] 得到命令起始所在行;

3. sed -n '/Currently\ defined\ functions/=' 用于定位命令所在行的位置;

4. for n in $() 循环读取$()命令输出的结果;

输出结果:

scue@Link:bootimg$ for n in $(adb shell busybox | sed -n "$[$(adb shell busybox | sed -n '/Currently\ defined\ functions/=')+1],$ p") ; do echo "symlink /sbin/busybox /sbin/$n" | awk -F',' '{print $1}'; done 
symlink /sbin/busybox /sbin/[
symlink /sbin/busybox /sbin/[[
symlink /sbin/busybox /sbin/arp
symlink /sbin/busybox /sbin/ash
symlink /sbin/busybox /sbin/awk
symlink /sbin/busybox /sbin/base64
symlink /sbin/busybox /sbin/basename
symlink /sbin/busybox /sbin/bbconfig
symlink /sbin/busybox /sbin/blockdev
symlink /sbin/busybox /sbin/brctl
symlink /sbin/busybox /sbin/bunzip2
symlink /sbin/busybox /sbin/bzcat
symlink /sbin/busybox /sbin/bzip2
symlink /sbin/busybox /sbin/cal
symlink /sbin/busybox /sbin/cat
symlink /sbin/busybox /sbin/catv
symlink /sbin/busybox /sbin/chattr
symlink /sbin/busybox /sbin/chgrp
symlink /sbin/busybox /sbin/chmod
symlink /sbin/busybox /sbin/chown
symlink /sbin/busybox /sbin/chroot
symlink /sbin/busybox /sbin/clear
symlink /sbin/busybox /sbin/cmp
symlink /sbin/busybox /sbin/comm
symlink /sbin/busybox /sbin/cp
symlink /sbin/busybox /sbin/cpio
symlink /sbin/busybox /sbin/crond
symlink /sbin/busybox /sbin/crontab
symlink /sbin/busybox /sbin/cut
symlink /sbin/busybox /sbin/date
symlink /sbin/busybox /sbin/dc
symlink /sbin/busybox /sbin/dd
symlink /sbin/busybox /sbin/depmod
symlink /sbin/busybox /sbin/devmem
symlink /sbin/busybox /sbin/df
symlink /sbin/busybox /sbin/diff
symlink /sbin/busybox /sbin/dirname
symlink /sbin/busybox /sbin/dmesg
symlink /sbin/busybox /sbin/dnsd
symlink /sbin/busybox /sbin/dos2unix
symlink /sbin/busybox /sbin/du
symlink /sbin/busybox /sbin/echo
symlink /sbin/busybox /sbin/ed
symlink /sbin/busybox /sbin/egrep
symlink /sbin/busybox /sbin/env
symlink /sbin/busybox /sbin/expand
symlink /sbin/busybox /sbin/expr
symlink /sbin/busybox /sbin/false
symlink /sbin/busybox /sbin/fdisk
symlink /sbin/busybox /sbin/fgrep
symlink /sbin/busybox /sbin/find
symlink /sbin/busybox /sbin/flash_lock
symlink /sbin/busybox /sbin/flash_unlock
symlink /sbin/busybox /sbin/flashcp
symlink /sbin/busybox /sbin/flock
symlink /sbin/busybox /sbin/fold
symlink /sbin/busybox /sbin/free
symlink /sbin/busybox /sbin/freeramdisk
symlink /sbin/busybox /sbin/fsync
symlink /sbin/busybox /sbin/ftpget
symlink /sbin/busybox /sbin/ftpput
symlink /sbin/busybox /sbin/fuser
symlink /sbin/busybox /sbin/getopt
symlink /sbin/busybox /sbin/grep
symlink /sbin/busybox /sbin/groups
symlink /sbin/busybox /sbin/gunzip
symlink /sbin/busybox /sbin/gzip
symlink /sbin/busybox /sbin/halt
symlink /sbin/busybox /sbin/head
symlink /sbin/busybox /sbin/hexdump
symlink /sbin/busybox /sbin/id
symlink /sbin/busybox /sbin/ifconfig
symlink /sbin/busybox /sbin/insmod
symlink /sbin/busybox /sbin/install
symlink /sbin/busybox /sbin/iostat
symlink /sbin/busybox /sbin/ip
symlink /sbin/busybox /sbin/kill
symlink /sbin/busybox /sbin/killall
symlink /sbin/busybox /sbin/killall5
symlink /sbin/busybox /sbin/less
symlink /sbin/busybox /sbin/ln
symlink /sbin/busybox /sbin/losetup
symlink /sbin/busybox /sbin/ls
symlink /sbin/busybox /sbin/lsattr
symlink /sbin/busybox /sbin/lsmod
symlink /sbin/busybox /sbin/lsusb
symlink /sbin/busybox /sbin/lzcat
symlink /sbin/busybox /sbin/lzma
symlink /sbin/busybox /sbin/lzop
symlink /sbin/busybox /sbin/lzopcat
symlink /sbin/busybox /sbin/man
symlink /sbin/busybox /sbin/md5sum
symlink /sbin/busybox /sbin/mesg
symlink /sbin/busybox /sbin/mkdir
symlink /sbin/busybox /sbin/mkdosfs
symlink /sbin/busybox /sbin/mke2fs
symlink /sbin/busybox /sbin/mkfifo
symlink /sbin/busybox /sbin/mkfs.ext2
symlink /sbin/busybox /sbin/mkfs.vfat
symlink /sbin/busybox /sbin/mknod
symlink /sbin/busybox /sbin/mkswap
symlink /sbin/busybox /sbin/mktemp
symlink /sbin/busybox /sbin/modinfo
symlink /sbin/busybox /sbin/modprobe
symlink /sbin/busybox /sbin/more
symlink /sbin/busybox /sbin/mount
symlink /sbin/busybox /sbin/mountpoint
symlink /sbin/busybox /sbin/mpstat
symlink /sbin/busybox /sbin/mv
symlink /sbin/busybox /sbin/nanddump
symlink /sbin/busybox /sbin/nandwrite
symlink /sbin/busybox /sbin/nbd-client
symlink /sbin/busybox /sbin/nc
symlink /sbin/busybox /sbin/netstat
symlink /sbin/busybox /sbin/nice
symlink /sbin/busybox /sbin/nohup
symlink /sbin/busybox /sbin/nslookup
symlink /sbin/busybox /sbin/ntpd
symlink /sbin/busybox /sbin/od
symlink /sbin/busybox /sbin/patch
symlink /sbin/busybox /sbin/pgrep
symlink /sbin/busybox /sbin/pidof
symlink /sbin/busybox /sbin/ping
symlink /sbin/busybox /sbin/pipe_progress
symlink /sbin/busybox /sbin/pkill
symlink /sbin/busybox /sbin/pmap
symlink /sbin/busybox /sbin/poweroff
symlink /sbin/busybox /sbin/printenv
symlink /sbin/busybox /sbin/printf
symlink /sbin/busybox /sbin/ps
symlink /sbin/busybox /sbin/pstree
symlink /sbin/busybox /sbin/pwd
symlink /sbin/busybox /sbin/pwdx
symlink /sbin/busybox /sbin/rdev
symlink /sbin/busybox /sbin/readlink
symlink /sbin/busybox /sbin/realpath
symlink /sbin/busybox /sbin/reboot
symlink /sbin/busybox /sbin/renice
symlink /sbin/busybox /sbin/reset
symlink /sbin/busybox /sbin/resize
symlink /sbin/busybox /sbin/rev
symlink /sbin/busybox /sbin/rm
symlink /sbin/busybox /sbin/rmdir
symlink /sbin/busybox /sbin/rmmod
symlink /sbin/busybox /sbin/route
symlink /sbin/busybox /sbin/run-parts
symlink /sbin/busybox /sbin/rx
symlink /sbin/busybox /sbin/sed
symlink /sbin/busybox /sbin/seq
symlink /sbin/busybox /sbin/setconsole
symlink /sbin/busybox /sbin/setserial
symlink /sbin/busybox /sbin/setsid
symlink /sbin/busybox /sbin/sh
symlink /sbin/busybox /sbin/sha1sum
symlink /sbin/busybox /sbin/sha256sum
symlink /sbin/busybox /sbin/sha512sum
symlink /sbin/busybox /sbin/sleep
symlink /sbin/busybox /sbin/sort
symlink /sbin/busybox /sbin/split
symlink /sbin/busybox /sbin/stat
symlink /sbin/busybox /sbin/strings
symlink /sbin/busybox /sbin/stty
symlink /sbin/busybox /sbin/sum
symlink /sbin/busybox /sbin/swapoff
symlink /sbin/busybox /sbin/swapon
symlink /sbin/busybox /sbin/sync
symlink /sbin/busybox /sbin/sysctl
symlink /sbin/busybox /sbin/tac
symlink /sbin/busybox /sbin/tail
symlink /sbin/busybox /sbin/tar
symlink /sbin/busybox /sbin/tee
symlink /sbin/busybox /sbin/telnet
symlink /sbin/busybox /sbin/telnetd
symlink /sbin/busybox /sbin/test
symlink /sbin/busybox /sbin/tftp
symlink /sbin/busybox /sbin/tftpd
symlink /sbin/busybox /sbin/time
symlink /sbin/busybox /sbin/timeout
symlink /sbin/busybox /sbin/top
symlink /sbin/busybox /sbin/touch
symlink /sbin/busybox /sbin/tr
symlink /sbin/busybox /sbin/traceroute
symlink /sbin/busybox /sbin/true
symlink /sbin/busybox /sbin/ttysize
symlink /sbin/busybox /sbin/tune2fs
symlink /sbin/busybox /sbin/umount
symlink /sbin/busybox /sbin/uname
symlink /sbin/busybox /sbin/uncompress
symlink /sbin/busybox /sbin/unexpand
symlink /sbin/busybox /sbin/uniq
symlink /sbin/busybox /sbin/unix2dos
symlink /sbin/busybox /sbin/unlzma
symlink /sbin/busybox /sbin/unlzop
symlink /sbin/busybox /sbin/unxz
symlink /sbin/busybox /sbin/unzip
symlink /sbin/busybox /sbin/uptime
symlink /sbin/busybox /sbin/usleep
symlink /sbin/busybox /sbin/uudecode
symlink /sbin/busybox /sbin/uuencode
symlink /sbin/busybox /sbin/vi
symlink /sbin/busybox /sbin/watch
symlink /sbin/busybox /sbin/wc
symlink /sbin/busybox /sbin/wget
symlink /sbin/busybox /sbin/which
symlink /sbin/busybox /sbin/whoami
symlink /sbin/busybox /sbin/xargs
symlink /sbin/busybox /sbin/xz
symlink /sbin/busybox /sbin/xzcat
symlink /sbin/busybox /sbin/yes
symlink /sbin/busybox /sbin/zcat
symlink /sbin/busybox /sbin/
scue@Link:bootimg$ 

然后把这个结果复制到ramdisk中的init.rc,这样就可以在开机过程中把所有的busybox命令映射出来了;

你可能感兴趣的:(android)