DEV Community

KOGA Mitsuhiro
KOGA Mitsuhiro

Posted on • Originally published at qiita.com

Bash on Ubuntu on Windows + オールインワンmintty

はじめに

先日、mattnさんがBash on Ubuntu on Windows の最高の端末環境を教えてやるからちょっと来い。と素晴しい記事を書かれていたのですが、cbwinも一緒に使えないかと思っていたら既に統合されたものがありました!!!

インストール

wsl-terminal/releaseから最新の7zもしくはzipをダウンロードして任意のフォルダーに展開するだけです。

使い方

  • open-wsl.exeをWindowsから実行するとminttyが起動します。
  • tools/add-open-wsl-here-menu.jsを実行するとエクスプローラのコンテキストメニューからminttyを実行できます。
  • run-wsl-file.exeをWindowsから実行すると.shなどのスクリプトを実行できます。

ログインシェルとして実行したい!

デフォルトのままではログインシェルではないので実行パスが起動時のカレントディレクトリになっていますが、minttyから使うときはログインシェルにしたいものです。
その場合は以下の設定でログインシェルとしてbashを実行してホームディレクトリから起動できます。

v0.5.1より後のバージョン

2016/9/9現在、まだリリースされていませんが、以下のコミットでopen-wsl.exeに-lオプションが追加されたので、これを利用します。
https://github.com/goreliu/wsl-terminal/commit/1b1b74b85f54dafb57c999e4c46bf0e756a96a96
https://github.com/goreliu/wsl-terminal/commit/7d0a8832acf00f0678063c4fddd83ecd35102e5e

v0.5.1以前のバージョン

wsl-terminal.confのshellを上記のコミットと同じようなコマンドに変更します。

[config]
title="        "
shell=bash -c "cd; bash -l"
use_cbwin=0
use_tmux=0

cbwin

wsl-terminalのbinフォルダーにcbwinが同梱されています。
Bash on Ubuntu on Windows側からインストーラを実行してetc/wsl-terminal.confuse_cbwin1に設定すればwcmd(Windowsのcmd)とwstart(Windowsのstart)を使うことができます。

cd bin && sudo ./install_cbwin.sh
[config]
title="        "
shell=bash
use_cbwin=1
use_tmux=0

以上でminttyを使いつつWindowsのコマンドを実行することもできる環境の完成です。

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay