BusyBox v1.20.0命令介绍(四)

/*********************************************************************
* Author          :     lile
* Modified        :     2019年12月28日星期六  10:56:13
* Email           :     [email protected]
* HomePage        :     lile777.blog.csdn.net
* CopyRight       :     该文章版权由lile所有。
*                       保留原文出处链接和本声明的前提下,可在非商业目的下任意传播和复制。
*                       对于商业目的下对本文的任何行为需经作者同意。
*********************************************************************/

151. swapon – 交换区设置

root@android:/ # busybox-smp swapon --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: swapon [-a] [-p PRI] [DEVICE]

Start swapping on DEVICE

	-a	Start swapping on all swap devices
	-p PRI	Set swap device priority

152. switch_root – 从initramfs中切换到新根文件系统

root@android:/ # busybox-smp switch_root --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT [ARGS]

Free initramfs and switch to another root fs:
chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,
execute NEW_INIT. PID must be 1. NEW_ROOT must be a mountpoint.

	-c DEV	Reopen stdio to DEV after switch

153. sysctl – 在运行态配置内核参数[★★★]

root@android:/ # busybox-smp sysctl --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: sysctl [OPTIONS] [VALUE]...

Configure kernel parameters at runtime

	-n	Don't print key names
	-e	Don't warn about unknown keys
	-w	Change sysctl setting
	-p FILE	Load sysctl settings from FILE (default /etc/sysctl.conf)
	-a	Display all values
	-A	Display all values in table form

154. syslogd – 系统日志工具[★★]

root@android:/ # busybox-smp syslogd --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: syslogd [OPTIONS]

System logging utility

	-n		Run in foreground
	-O FILE		Log to FILE (default:/var/log/messages)
	-l N		Log only messages more urgent than prio N (1-8)
	-S		Smaller output
	-s SIZE		Max size (KB) before rotation (default:200KB, 0=off)
	-b N		N rotated logs to keep (default:1, max=99, 0=purge)
	-R HOST[:PORT]	Log to IP or hostname on PORT (default PORT=514/UDP)
	-L		Log locally and via network (default is network only if -R)
	-D		Drop duplicates
	-C[size_kb]	Log to shared mem buffer (use logread to read it)
	-f FILE		Use FILE as config (default:/etc/syslog.conf)

155. tac – 与cat相反,逆序输出字符

root@android:/ # busybox-smp tac --help 
// http://codingstandards.iteye.com/blog/830800
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tac [FILE]...

Concatenate FILEs and print them in reverse

156. tcpsvd – 创建TCP连接/监听并用指定程序处理[★★]

root@android:/ # busybox-smp tcpsvd --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tcpsvd [-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG

Create TCP socket, bind to IP:PORT and listen
for incoming connection. Run PROG for each connection.

	IP		IP to listen on, 0 = all
	PORT		Port to listen on
	PROG ARGS	Program to run
	-l NAME		Local hostname (else looks up local hostname in DNS)
	-u USER[:GRP]	Change to user/group after bind
	-c N		Handle up to N connections simultaneously
	-b N		Allow a backlog of approximately N TCP SYNs
	-C N[:MSG]	Allow only up to N connections from the same IP
			New connections from this IP address are closed
			immediately. MSG is written to the peer before close
	-h		Look up peer's hostname
	-E		Don't set up environment variables
	-v		Verbose

157. tee – 将标准输入同步输出到文件,可做日志记录[★★]

root@android:/ # busybox-smp tee --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tee [-ai] [FILE]...

Copy stdin to each FILE, and also to stdout

	-a	Append to the given FILEs, don't overwrite
	-i	Ignore interrupt signals (SIGINT)

158. telnetd – telnet服务端[★★]

root@android:/ # busybox-smp telnetd --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: telnetd [OPTIONS]

Handle incoming telnet connections

	-l LOGIN	Exec LOGIN on connect
	-f ISSUE_FILE	Display ISSUE_FILE instead of /etc/issue
	-K		Close connection as soon as login exits
			(normally wait until all programs close slave pty)
	-p PORT		Port to listen on
	-b ADDR[:PORT]	Address to bind to
	-F		Run in foreground
	-i		Inetd mode
	-w SEC		Inetd 'wait' mode, linger time SEC
	-S		Log to syslog (implied by -i or without -F and -w)

159. tftpd – tftp服务端[★★]

root@android:/ # busybox-smp tftpd --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tftpd [-cr] [-u USER] [DIR]

Transfer a file on tftp client's request

tftpd should be used as an inetd service.
tftpd's line for inetd.conf:
	69 dgram udp nowait root tftpd tftpd -l /files/to/serve
It also can be ran from udpsvd:
	udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve

	-r	Prohibit upload
	-c	Allow file creation via upload
	-u	Access files as USER
	-l	Log to syslog (inetd mode requires this)

160. tr – 对来自标准输入的字符进行替换、压缩和删除

root@android:/ # busybox-smp tr --help
// http://man.linuxde.net/tr
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tr [-cds] STRING1 [STRING2]

Translate, squeeze, or delete characters from stdin, writing to stdout

	-c	Take complement of STRING1
	-d	Delete input characters coded STRING1
	-s	Squeeze multiple output characters of STRING2 into one character

161. traceroute – 追踪数据包在网络上的传输时的全部路径[★★]

root@android:/ # busybox-smp traceroute --help 
// http://man.linuxde.net/traceroute
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: traceroute [-46FIldnrv] [-f 1ST_TTL] [-m MAXTTL] [-p PORT] [-q PROBES]
	[-s SRC_IP] [-t TOS] [-w WAIT_SEC] [-g GATEWAY] [-i IFACE]
	[-z PAUSE_MSEC] HOST [BYTES]

Trace the route to HOST

	-4,-6	Force IP or IPv6 name resolution
	-F	Set the don't fragment bit
	-I	Use ICMP ECHO instead of UDP datagrams
	-l	Display the TTL value of the returned packet
	-d	Set SO_DEBUG options to socket
	-n	Print numeric addresses
	-r	Bypass routing tables, send directly to HOST
	-v	Verbose
	-m	Max time-to-live (max number of hops)
	-p	Base UDP port number used in probes
		(default 33434)
	-q	Number of probes per TTL (default 3)
	-s	IP address to use as the source address
	-t	Type-of-service in probe packets (default 0)
	-w	Time in seconds to wait for a response (default 3)
	-g	Loose source route gateway (8 max)

162. true – 返回真值

root@android:/ # busybox-smp true --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: true 

Return an exit code of TRUE (0)

163. tty – 返回当前终端的名称[★]

root@android:/ # busybox-smp tty --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tty 

Print file name of stdin's terminal

	-s	Print nothing, only return exit status

root@android:/ # tty 
/dev/pts/1

164. ttysize – 打印终端的位置坐标

root@android:/ # busybox-smp ttysize --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: ttysize [w] [h]

Print dimension(s) of stdin's terminal, on error return 80x25

165. tunctl – 创建和配置虚拟网卡

root@android:/ # busybox-smp tunctl --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: tunctl [-f device] ([-t name] | -d name) [-u owner] [-g group] [-b]

Create or delete tun interfaces

	-f name		tun device (/dev/net/tun)
	-t name		Create iface 'name'
	-d name		Delete iface 'name'
	-u owner	Set iface owner
	-g group	Set iface group
	-b		Brief output

166. udhcpc – DHCP客户端[★]

root@android:/ # busybox-smp udhcpc --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: udhcpc [-fbnqvoCRB] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]
	[-V VENDOR] [-x OPT:VAL]... [-O OPT]...

	-i,--interface IFACE	Interface to use (default eth0)
	-p,--pidfile FILE	Create pidfile
	-s,--script PROG	Run PROG at DHCP events (default /usr/share/udhcpc/default.script)
	-B,--broadcast		Request broadcast replies
	-t,--retries N		Send up to N discover packets
	-T,--timeout N		Pause between packets (default 3 seconds)
	-A,--tryagain N		Wait N seconds after failure (default 20)
	-f,--foreground		Run in foreground
	-b,--background		Background if lease is not obtained
	-n,--now		Exit if lease is not obtained
	-q,--quit		Exit after obtaining lease
	-R,--release		Release IP on exit
	-S,--syslog		Log to syslog too
	-a,--arping		Use arping to validate offered address
	-O,--request-option OPT	Request option OPT from server (cumulative)
	-o,--no-default-options	Don't request any options (unless -O is given)
	-r,--request IP		Request this IP address
	-x OPT:VAL		Include option OPT in sent packets (cumulative)
				Examples of string, numeric, and hex byte opts:
				-x hostname:bbox - option 12
				-x lease:3600 - option 51 (lease time)
				-x 0x3d:0100BEEFC0FFEE - option 61 (client id)
	-F,--fqdn NAME		Ask server to update DNS mapping for NAME
	-V,--vendorclass VENDOR	Vendor identifier (default 'udhcp VERSION')
	-C,--clientid-none	Don't send MAC as client identifier
	-v			Verbose
Signals:
	USR1	Renew lease
	USR2	Release lease

167. udpsvd – 创建监听UDP连接并用指定程序处理[★★]

root@android:/ # busybox-smp udpsvd --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: udpsvd [-hEv] [-c N] [-u USER] [-l NAME] IP PORT PROG

Create UDP socket, bind to IP:PORT and wait
for incoming packets. Run PROG for each packet,
redirecting all further packets with same peer ip:port to it.

	IP		IP to listen on, 0 = all
	PORT		Port to listen on
	PROG ARGS	Program to run
	-l NAME		Local hostname (else looks up local hostname in DNS)
	-u USER[:GRP]	Change to user/group after bind
	-c N		Handle up to N connections simultaneously
	-h		Look up peer's hostname
	-E		Don't set up environment variables
	-v		Verbose

168. unexpand – 将给定文件中的空白字符转换为制表符

root@android:/ # busybox-smp unexpand --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: unexpand [-fa][-t N] [FILE]...

Convert spaces to tabs, writing to stdout

	-a,--all	Convert all blanks
	-f,--first-only	Convert only leading blanks
	-t,--tabs=N	Tabstops every N chars

169. uniq – 报告或忽略文件中的重复行

// http://man.linuxde.net/uniq
root@android:/ # busybox-smp uniq --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: uniq [-cdu][-f,s,w N] [INPUT [OUTPUT]]

Discard duplicate lines

	-c	Prefix lines by the number of occurrences
	-d	Only print duplicate lines
	-u	Only print unique lines
	-f N	Skip first N fields
	-s N	Skip first N chars (after any skipped fields)
	-w N	Compare N characters in line

170. unix2dos – dos/unix文本编码转换[★★]

root@android:/ # busybox-smp unix2dos --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: unix2dos [-ud] [FILE]

Convert FILE in-place from Unix to DOS format.
When no file is given, use stdin/stdout.

	-u	dos2unix
	-d	unix2dos

171. uptime – 显示开机时间

root@android:/ # busybox-smp uptime --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: uptime 

Display the time since the last boot

172. users – 打印当前登陆用户[★]

root@android:/ # busybox-smp users --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: users 

Print the users currently logged on

173. uudecode – 将 uuencode 编码后的档案还原

root@android:/ # busybox-smp uudecode --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: uudecode [-o OUTFILE] [INFILE]

Uudecode a file
Finds OUTFILE in uuencoded source unless -o is given

174. uuencode – uuencode 编码档案

root@android:/ # busybox-smp uuencode --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: uuencode [-m] [FILE] STORED_FILENAME

Uuencode FILE (or stdin) to stdout

	-m	Use base64 encoding per RFC1521

175. vconfig – 创建/删除虚拟网卡设备

root@android:/ # busybox-smp vconfig --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: vconfig COMMAND [OPTIONS]

Create and remove virtual ethernet devices

	add		IFACE VLAN_ID
	rem		VLAN_NAME
	set_flag	IFACE 0|1 VLAN_QOS
	set_egress_map	VLAN_NAME SKB_PRIO VLAN_QOS
	set_ingress_map	VLAN_NAME SKB_PRIO VLAN_QOS
	set_name_type	NAME_TYPE

176. vlock – 锁定虚拟终端

root@android:/ # busybox-smp vlock --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: vlock [-a]

Lock a virtual terminal. A password is required to unlock.

	-a	Lock all VTs

177. volname – 显示指定的“ISO-9660”格式的设备的卷名称

root@android:/ # busybox-smp volname --help 
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: volname [DEVICE]

Show CD volume name of the DEVICE (default /dev/cdrom)

178. wall – 消息广播[★]

root@android:/ # busybox-smp wall --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: wall [FILE]

Write content of FILE or stdin to all logged-in users

179. watch – 定期运行指定程序

root@android:/ # busybox-smp watch --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: watch [-n SEC] [-t] PROG ARGS

Run PROG periodically

	-n	Loop period in seconds (default 2)
	-t	Don't print header

180. watchdog – 周期写看门狗设备

root@android:/ # busybox-smp watchdog --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: watchdog [-t N[ms]] [-T N[ms]] [-F] DEV

Periodically write to watchdog device DEV

	-T N	Reboot after N seconds if not reset (default 60)
	-t N	Reset every N seconds (default 30)
	-F	Run in foreground

Use 500ms to specify period in milliseconds

181. wget – 下载命令[★]

root@android:/ # busybox-smp wget --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: wget [-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE]
	[--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
	[--no-check-certificate] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	-s	Spider mode - only check file existence
	-c	Continue retrieval of aborted transfer
	-q	Quiet
	-P DIR	Save to DIR (default .)
	-T SEC	Network read timeout is SEC seconds
	-O FILE	Save to FILE ('-' for stdout)
	-U STR	Use STR for User-Agent header
	-Y	Use proxy ('on' or 'off')

182. which – 定位命令绝对路径[★]

root@android:/ # busybox-smp which --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: which [COMMAND]...

Locate a COMMAND

183. who – 显示当前登陆用户[★]

root@android:/ # busybox-smp who --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: who [-a]

Show who is logged on

	-a	Show all
	-H	Print column headers

184. whois – 查找并显示指定帐号的用户相关信息[★]

root@android:/ # busybox-smp whois --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: whois [-h SERVER] [-p PORT] NAME…

Query WHOIS info about NAME

-h,-p	Server to query

185. xargs – 传递上个执行结果给后续进程使用[★★★]

root@android:/ # busybox-smp xargs --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: xargs [OPTIONS] [PROG ARGS]

Run PROG on every item given by stdin

	-p	Ask user whether to run each command
	-r	Don't run command if input is empty
	-0	Input is separated by NUL characters
	-t	Print the command on stderr before execution
	-e[STR]	STR stops input processing
	-n N	Pass no more than N args to PROG
	-s N	Pass command line of no more than N bytes
	-x	Exit if size is exceeded

186. xz – 解压文件

root@android:/ # busybox-smp xz --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: xz -d [-cf] [FILE]...

Decompress FILE (or stdin)

	-d	Decompress
	-c	Write to stdout
	-f	Force

187. xzcat – 查看压缩包内容

root@android:/ # busybox-smp xzcat --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: xzcat FILE

Decompress to stdout

188. yes – 重复输出字符串

root@android:/ # busybox-smp yes --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: yes [STRING]

Repeatedly output a line with STRING, or 'y'

189. zcat – 查看压缩包内容

root@android:/ # busybox-smp zcat --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: zcat FILE

Decompress to stdout

190. zcip – 管理IPv4本地地址

root@android:/ # busybox-smp zcip --help
BusyBox v1.20.0 (2012-08-22 21:36:24 CDT) multi-call binary.

Usage: zcip [OPTIONS] IFACE SCRIPT

Manage a ZeroConf IPv4 link-local address

	-f		Run in foreground
	-q		Quit after obtaining address
	-r 169.254.x.x	Request this address first
	-v		Verbose

With no -q, runs continuously monitoring for ARP conflicts,
exits only on I/O errors (link down etc)

后记

root@android:/ # ls -lh /system/bin/busybox-smp
-rwxr-xr-x    1 0        2000        1.0M Sep  5  2013 /system/bin/busybox-smp

整体过一遍下来,不得不感慨busybox这把瑞士军刀的厉害,在这么小的体积内蕴含了如此丰富的功能,这应该就是开源的力量吧!

你可能感兴趣的:(Linux,命令)