LoginSignup
58
55

More than 5 years have passed since last update.

Bash on Windows 10を使い始めてみた。

Last updated at Posted at 2016-04-10

Windowsでシェル,という古くて新しいお題。
毎年のように,"今時点でのベストはこれ"という話題が出てくる。

近時の話題は,本家MSがWindows10の大規模アップデート「Anniversary Update to Windows 10」(一般向けは2016夏公開を予定)で導入するという「Windows Subsystem for Linux」のbash(関連記事)。

要するにただのbashなのだが,ただのbashが素のwindowsで使えることが,MSに近しい人々にとっては大ニュース。。
1ユーザーとして考えると,単にLinuxやMacと同様のシェルが使えるようになるだけなので,あってもいいかな,程度の話。

個人的には,Ubuntuと親和的に開発されているというのが少しうれしい。せっかくなので,既に使用レポートを挙げていてくださる方々()を参考にWindows 週末に使い始めてみることにした。

準備作業:WindowsInsiderProgramに加入

MSのサイトにアクセス

MSのアカウントでInsiderプログラムに参加。
insider1.PNG

’設定’でInsiderPreviewビルドを有効にする。

そして再起動。

insider2.PNG

Insiderレベルをfastに設定

そして,しばらく待つ。...一見さんお断りなのか,なかなか通知は来ない。。
insider3.PNG

1日以上たって,Insider Previewが利用可能になる。

Insider Previewを試すこと自体忘れつつあった...
insider4.PNG

まずはインストール。

すごく平凡な体験を予感しつつ一晩待つ。

そもそもこのPCにはcygwin(babun)が入っているので,pwdやらdf -hやら,bashなコマンドが普通に通る。さて,Insider Previewを入れて何が変わるのか変わらないのか...ともあれ再起動。 いろいろ設定が続くので一晩待つ。
http://babun.github.io/

Cortana経由で"windowsの機能"を呼び出し,Windows Bussystem for Linux(Beta)を有効にして再起動。

insider5.PNG

コマンドラインを立ち上げコマンドを叩いてみる。

[訂正] コマンドラインでbashと入力し,しばらく待つ。

c:\Hugo\sites>bash
-- Beta feature --
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms

Type "y" to continue: y
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes...
??????????????????????????...
root@localhost:/mnt/c/Hugo/sites# ls
archetypes  config.toml  content  data  firebase.json  layouts  public  static  themes
root@localhost:/mnt/c/Hugo/sites# pwd
/mnt/c/Hugo/sites
root@localhost:/mnt/c/Hugo/sites#

必要なツールはubuntu流に,apt-getで落としていく。
例:gitを入れる:

root@localhost:/mnt/c/Users/geeks/codes# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
(略)
Unpacking git (1:1.9.1-1ubuntu0.3) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up liberror-perl (0.17-1.1) ...
Setting up git-man (1:1.9.1-1ubuntu0.3) ...
Setting up git (1:1.9.1-1ubuntu0.3) ...

感想:無難に動く模様。

なぜかinsider previewにしたらchromeが頻繁に落ちるようになった。土曜日に思い立ってもはや月曜日なのでレポートは以上。。。

追記 : Hugoインストール作業記録

せっかくなので,Bash on windowsを適宜活用して,Hugoのインストール作業を行ってみた:
http://qiita.com/kmry2045/items/ea860ebfb1214aacaf43

bashを使えたほうがやはり作業は速くなる。積極的にwindowsを嫌う理由がまた一つ減った感じ。

追記② : 恥ずかしいミス

元々サードパーティーのbabunでbash使っていたため,それをbash on windowsとしばらく勘違いしていた。。。
上に訂正した通り, コマンドラインでbashとタイプし,それでbash on windowsがダウンロードされ,使用できるようになる。...使用感は,babunと大差なし,多分。

58
55
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
58
55