【2022年9月版】Windows への busybox 導入

# Windows への busybox 導入

## はじめに

- windowsで unix|linux like なコマンドを環境を汚さずに使いたい。。。
- wsl入れるほどでもない、cygwin入れるほどでもない。。。
- そうだ busybox しよう

## busybox 導入

- busybox のダウンロード

  - [BusyBox for Windows](http://frippery.org/busybox/) から busybox.exe または、 busybox64.exe をダウンロードする

- インストール

  - ダウンロードしたexeを好きなフォルダに配置する。 
    Ex: ```C:\tools\busybox\busybox64.exe```

- busybox のコマンドを展開する
    - ここでは、busyboxを配置したディレクトリのbinに展開する

```terminal
> cd ../../tools/busybox
> mkdir bin
> busybox64.exe --install ./bin
2022/09/29  07:52    <DIR>          .
2022/09/29  07:52    <DIR>          ..
2022/09/29  07:50           646,656 ar.exe
2022/09/29  07:50           646,656 arch.exe
2022/09/29  07:50           646,656 ascii.exe
2022/09/29  07:50           646,656 ash.exe
2022/09/29  07:50           646,656 awk.exe
2022/09/29  07:50           646,656 base32.exe
2022/09/29  07:50           646,656 base64.exe
2022/09/29  07:50           646,656 basename.exe
2022/09/29  07:50           646,656 bash.exe
2022/09/29  07:50           646,656 bc.exe
2022/09/29  07:50           646,656 bunzip2.exe
2022/09/29  07:50           646,656 busybox.exe
2022/09/29  07:50           646,656 bzcat.exe
2022/09/29  07:50           646,656 bzip2.exe
2022/09/29  07:50           646,656 cal.exe
2022/09/29  07:50           646,656 cat.exe
2022/09/29  07:50           646,656 chattr.exe
2022/09/29  07:50           646,656 chmod.exe
2022/09/29  07:50           646,656 cksum.exe
2022/09/29  07:50           646,656 clear.exe
2022/09/29  07:50           646,656 cmp.exe
2022/09/29  07:50           646,656 comm.exe
2022/09/29  07:50           646,656 cp.exe
2022/09/29  07:50           646,656 cpio.exe
2022/09/29  07:50           646,656 crc32.exe
2022/09/29  07:50           646,656 cut.exe
2022/09/29  07:50           646,656 date.exe
2022/09/29  07:50           646,656 dc.exe
2022/09/29  07:50           646,656 dd.exe
2022/09/29  07:50           646,656 df.exe
2022/09/29  07:50           646,656 diff.exe
2022/09/29  07:50           646,656 dirname.exe
2022/09/29  07:50           646,656 dos2unix.exe
2022/09/29  07:50           646,656 dpkg-deb.exe
2022/09/29  07:50           646,656 dpkg.exe
2022/09/29  07:50           646,656 du.exe
2022/09/29  07:50           646,656 echo.exe
2022/09/29  07:50           646,656 ed.exe
2022/09/29  07:50           646,656 egrep.exe
2022/09/29  07:50           646,656 env.exe
2022/09/29  07:50           646,656 expand.exe
2022/09/29  07:50           646,656 expr.exe
2022/09/29  07:50           646,656 factor.exe
2022/09/29  07:50           646,656 false.exe
2022/09/29  07:50           646,656 fgrep.exe
2022/09/29  07:50           646,656 find.exe
2022/09/29  07:50           646,656 fold.exe
2022/09/29  07:50           646,656 free.exe
2022/09/29  07:50           646,656 fsync.exe
2022/09/29  07:50           646,656 ftpget.exe
2022/09/29  07:50           646,656 ftpput.exe
2022/09/29  07:50           646,656 getopt.exe
2022/09/29  07:50           646,656 grep.exe
2022/09/29  07:50           646,656 groups.exe
2022/09/29  07:50           646,656 gunzip.exe
2022/09/29  07:50           646,656 gzip.exe
2022/09/29  07:50           646,656 hd.exe
2022/09/29  07:50           646,656 head.exe
2022/09/29  07:50           646,656 hexdump.exe
2022/09/29  07:50           646,656 httpd.exe
2022/09/29  07:50           646,656 iconv.exe
2022/09/29  07:50           646,656 id.exe
2022/09/29  07:50           646,656 inotifyd.exe
2022/09/29  07:50           646,656 install.exe
2022/09/29  07:50           646,656 ipcalc.exe
2022/09/29  07:50           646,656 jn.exe
2022/09/29  07:50           646,656 kill.exe
2022/09/29  07:50           646,656 killall.exe
2022/09/29  07:50           646,656 less.exe
2022/09/29  07:50           646,656 link.exe
2022/09/29  07:50           646,656 ln.exe
2022/09/29  07:50           646,656 logname.exe
2022/09/29  07:50           646,656 ls.exe
2022/09/29  07:50           646,656 lsattr.exe
2022/09/29  07:50           646,656 lzcat.exe
2022/09/29  07:50           646,656 lzma.exe
2022/09/29  07:50           646,656 lzop.exe
2022/09/29  07:50           646,656 lzopcat.exe
2022/09/29  07:50           646,656 man.exe
2022/09/29  07:50           646,656 md5sum.exe
2022/09/29  07:50           646,656 mkdir.exe
2022/09/29  07:50           646,656 mktemp.exe
2022/09/29  07:50           646,656 mv.exe
2022/09/29  07:50           646,656 nc.exe
2022/09/29  07:50           646,656 nl.exe
2022/09/29  07:50           646,656 nproc.exe
2022/09/29  07:50           646,656 od.exe
2022/09/29  07:50           646,656 paste.exe
2022/09/29  07:50           646,656 patch.exe
2022/09/29  07:50           646,656 pgrep.exe
2022/09/29  07:50           646,656 pidof.exe
2022/09/29  07:50           646,656 pipe_progress.exe
2022/09/29  07:50           646,656 pkill.exe
2022/09/29  07:50           646,656 printenv.exe
2022/09/29  07:50           646,656 printf.exe
2022/09/29  07:50           646,656 ps.exe
2022/09/29  07:50           646,656 pwd.exe
2022/09/29  07:50           646,656 readlink.exe
2022/09/29  07:50           646,656 realpath.exe
2022/09/29  07:50           646,656 reset.exe
2022/09/29  07:50           646,656 rev.exe
2022/09/29  07:50           646,656 rm.exe
2022/09/29  07:50           646,656 rmdir.exe
2022/09/29  07:50           646,656 rpm.exe
2022/09/29  07:50           646,656 rpm2cpio.exe
2022/09/29  07:50           646,656 sed.exe
2022/09/29  07:50           646,656 seq.exe
2022/09/29  07:50           646,656 sh.exe
2022/09/29  07:50           646,656 sha1sum.exe
2022/09/29  07:50           646,656 sha256sum.exe
2022/09/29  07:50           646,656 sha3sum.exe
2022/09/29  07:50           646,656 sha512sum.exe
2022/09/29  07:50           646,656 shred.exe
2022/09/29  07:50           646,656 shuf.exe
2022/09/29  07:50           646,656 sleep.exe
2022/09/29  07:50           646,656 sort.exe
2022/09/29  07:50           646,656 split.exe
2022/09/29  07:50           646,656 ssl_client.exe
2022/09/29  07:50           646,656 stat.exe
2022/09/29  07:50           646,656 strings.exe
2022/09/29  07:50           646,656 su.exe
2022/09/29  07:50           646,656 sum.exe
2022/09/29  07:50           646,656 sync.exe
2022/09/29  07:50           646,656 tac.exe
2022/09/29  07:50           646,656 tail.exe
2022/09/29  07:50           646,656 tar.exe
2022/09/29  07:50           646,656 tee.exe
2022/09/29  07:50           646,656 test.exe
2022/09/29  07:50           646,656 time.exe
2022/09/29  07:50           646,656 timeout.exe
2022/09/29  07:50           646,656 touch.exe
2022/09/29  07:50           646,656 tr.exe
2022/09/29  07:50           646,656 true.exe
2022/09/29  07:50           646,656 truncate.exe
2022/09/29  07:50           646,656 ts.exe
2022/09/29  07:50           646,656 tsort.exe
2022/09/29  07:50           646,656 ttysize.exe
2022/09/29  07:50           646,656 uname.exe
2022/09/29  07:50           646,656 uncompress.exe
2022/09/29  07:50           646,656 unexpand.exe
2022/09/29  07:50           646,656 uniq.exe
2022/09/29  07:50           646,656 unix2dos.exe
2022/09/29  07:50           646,656 unlink.exe
2022/09/29  07:50           646,656 unlzma.exe
2022/09/29  07:50           646,656 unlzop.exe
2022/09/29  07:50           646,656 unxz.exe
2022/09/29  07:50           646,656 unzip.exe
2022/09/29  07:50           646,656 uptime.exe
2022/09/29  07:50           646,656 usleep.exe
2022/09/29  07:50           646,656 uudecode.exe
2022/09/29  07:50           646,656 uuencode.exe
2022/09/29  07:50           646,656 vi.exe
2022/09/29  07:50           646,656 watch.exe
2022/09/29  07:50           646,656 wc.exe
2022/09/29  07:50           646,656 wget.exe
2022/09/29  07:50           646,656 which.exe
2022/09/29  07:50           646,656 whoami.exe
2022/09/29  07:50           646,656 whois.exe
2022/09/29  07:50           646,656 xargs.exe
2022/09/29  07:50           646,656 xxd.exe
2022/09/29  07:50           646,656 xz.exe
2022/09/29  07:50           646,656 xzcat.exe
2022/09/29  07:50           646,656 yes.exe
2022/09/29  07:50           646,656 zcat.exe
2022/09/29  07:50           646,656 [.exe
2022/09/29  07:50           646,656 [[.exe
             166 個のファイル         107,344,896 バイト
               2 個のディレクトリ  850,438,402,048 バイトの空き領域
```

- PATH を通す

  - システムの詳細設定 -> 詳細設定 -> 環境変数 -> ユーザ環境変数 -> Path に展開したディレクトリを追加
    Ex: ```C:\tools\busybox\bin```
  
- 新しいコマンドプロンプトを開いて、busybox のコマンドが使えることを確認する

```terminal
> vi -h
BusyBox v1.36.0-FRP-4716-g31467ddfc (2022-06-09 19:36:25 BST)

Usage: vi [-c CMD] [-R] [-H] [FILE]...

Edit FILE

        -c CMD  Initial command to run ($EXINIT and ~/.exrc also available)
        -R      Read-only
        -H      List available features
```

## おわりに

- かんたんでしたね