LoginSignup
1
0

BusyBoxを使ってみる

Posted at

万能コマンドと名高いBusyBox。
導入方法と最低限の使い方を確認しておく。

公式サイトのFAQを参考に、まずはダウンロード。

$ wget https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox
--2024-03-06 22:36:36--  https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox
Resolving busybox.net (busybox.net)... 140.211.167.122
Connecting to busybox.net (busybox.net)|140.211.167.122|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1131168 (1.1M)
Saving to: ‘busybox’

busybox                                     100%[===========================================================================================>]   1.08M   552KB/s    in 2.0s    

2024-03-06 22:36:49 (552 KB/s) - ‘busybox’ saved [1131168/1131168]

$ 

実行権限を付与。

$ chmod 755 busybox

lsコマンド。

$ ./busybox ls /var
account   cache     empty     games     lib       lock      mail      opt       run       tmp
adm       db        ftp       kerberos  local     log       nis       preserve  spool     yp
$ 

catとhead。
もちろんパイプでコマンドを繋ぐことも可能

$ ./busybox cat /etc/logrotate.conf | ./busybox head
# see "man logrotate" for details

# global options do not affect preceding include directives

# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

$ 

概ね<PATH>/busybox <COMMAND>の要領で使えば良いと理解した。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0