busybox 安装使用

时间:2024-03-02 15:31:21

busybox 安装使用

有人将 BusyBox 称为 Linux 工具里的瑞士军刀。简单的说BusyBox就好像是个大工具箱,它集成压缩了 Linux 的许多工具和命令。

全自动安装命令

curl -so /usr/bin/busybox https://busybox.net/downloads/binaries/1.30.0-i686/busybox  ; chmod +x /usr/bin/busybox ; busybox --help

使用方法

[root@5kohi ~]# busybox w
USER		TTY		IDLE	TIME		 HOST
root            pts/0           00:09   Feb  2 10:58:40  124.1.244.29
root            pts/1           00:08   Feb  2 13:34:20  124.1.244.29
root            pts/2           00:00   Feb  2 14:27:01  124.1.244.29
[root@5kohi ~]# busybox id
uid=0(root) gid=0(root) groups=0(root)
[root@5kohi ~]# busybox hostname
5kohi
[root@5kohi ~]# busybox df
Filesystem           1K-blocks      Used Available Use% Mounted on
devtmpfs               8123944         0   8123944   0% /dev
tmpfs                  8133588         0   8133588   0% /dev/shm
tmpfs                  8133588     57828   8075760   1% /run
tmpfs                  8133588         0   8133588   0% /sys/fs/cgroup
/dev/vda1            412712712   2837844 393029560   1% /
tmpfs                  1626720         0   1626720   0% /run/user/0

分步安装过程

1、下载busybox到环境变量目录下
[root@5kohi ~]# curl -so /usr/bin/busybox https://busybox.net/downloads/binaries/1.30.0-i686/busybox 
2、给busybox二进制文件赋可执行权限
[root@5kohi ~]# chmod +x /usr/bin/busybox 
3、查看一下busybox帮助
[root@5kohi ~]# busybox --help
BusyBox v1.30.0 (2018-12-30 22:25:27 CET) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --show SCRIPT
   or: busybox --install [-s] [DIR]
   or: function [arguments]...

	BusyBox is a multi-call binary that combines many common Unix
	utilities into a single executable.  Most people will create a
	link to busybox for each function they wish to use and BusyBox
	will act like whatever it was invoked as.

Currently defined functions:
	[, [[, acpid, add-shell, addgroup, adduser, adjtimex, ar,
	arch, arp, arping, ash, awk, base64, basename, bc,
	blkdiscard, blkid, blockdev, bootchartd, brctl, bunzip2,
	bzcat, bzip2, cal, cat, chat, chattr, chgrp, chmod, chown,
	chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp,
	comm, conspy, cp, cpio, crond, crontab, cryptpw, cttyhack,
	cut, date, dc, dd, deallocvt, delgroup, deluser, depmod,
	devmem, df, dhcprelay, diff, dirname, dmesg, dnsd,
	dnsdomainname, dos2unix, dpkg, dpkg-deb, du, dumpkmap,
	dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid,
	expand, expr, factor, fakeidentd, false, fatattr, fbset,
	fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find,
	findfs, flash_eraseall, flash_lock, flash_unlock, flashcp,
	flock, fold, free, freeramdisk, fsck, fsck.minix, fsfreeze,
	fstrim, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty,
	grep, groups, gunzip, gzip, halt, hd, hdparm, head, hexdump,
	hexedit, hostid, hostname, httpd, hush, hwclock, i2cdetect,
	i2cdump, i2cget, i2cset, id, ifconfig, ifenslave, ifplugd,
	inetd, init, inotifyd, insmod, install, ionice, iostat, ip,
	ipaddr, ipcalc, ipcrm, ipcs, iplink, ipneigh, iproute,
	iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd,
	last, less, link, linux32, linux64, linuxrc, ln, loadfont,
	loadkmap, logger, login, logname, losetup, lpd, lpq, lpr,
	ls, lsattr, lsmod, lsof, lspci, lsscsi, lsusb, lzcat, lzma,
	lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg,
	microcom, mkdir, mkdosfs, mke2fs, mkfifo, mkfs.ext2,
	mkfs.minix, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp,
	modinfo, modprobe, more, mount, mountpoint, mpstat, mt, mv,
	nameif, nbd-client, nc, netstat, nice, nl, nmeter, nohup,
	nologin, nproc, ntpd, nuke, od, openvt, partprobe, passwd,
	paste, patch, pgrep, pidof, ping, ping6, pipe_progress,
	pivot_root, pkill, pmap, popmaildir, poweroff, powertop,
	printenv, printf, ps, pscan, pstree, pwd, pwdx, raidautorun,
	rdate, rdev, readlink, readprofile, realpath, reboot,
	reformime, remove-shell, renice, reset, resize, resume, rev,
	rm, rmdir, rmmod, route, rpm, rpm2cpio, rtcwake, run-init,
	run-parts, runlevel, runsv, runsvdir, rx, script,
	scriptreplay, sed, sendmail, seq, setarch, setconsole,
	setfattr, setfont, setkeycodes, setlogcons, setpriv,
	setserial, setsid, setuidgid, sh, sha1sum, sha256sum,
	sha3sum, sha512sum, showkey, shred, shuf, slattach, sleep,
	smemcap, softlimit, sort, split, ssl_client,
	start-stop-daemon, stat, strings, stty, su, sulogin, sum,
	sv, svc, svlogd, svok, swapoff, swapon, switch_root, sync,
	sysctl, syslogd, tac, tail, tar, taskset, tc, tcpsvd, tee,
	telnet, telnetd, test, tftp, tftpd, time, timeout, top,
	touch, tr, traceroute, traceroute6, true, truncate, tty,
	ttysize, tunctl, tune2fs, ubiattach, ubidetach, ubimkvol,
	ubirename, ubirmvol, ubirsvol, ubiupdatevol, udhcpc, udhcpd,
	udpsvd, uevent, umount, uname, uncompress, unexpand, uniq,
	unix2dos, unlink, unlzma, unlzop, unxz, unzip, uptime,
	users, usleep, uudecode, uuencode, vconfig, vi, vlock,
	volname, w, wall, watch, watchdog, wc, wget, which, who,
	whoami, whois, xargs, xxd, xz, xzcat, yes, zcat, zcip