{"id":6187,"date":"2016-08-05T16:12:07","date_gmt":"2016-08-05T15:12:07","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=6187"},"modified":"2016-08-05T16:53:51","modified_gmt":"2016-08-05T15:53:51","slug":"how-to-enable-the-linux-bash-subsystem-in-windows-10","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=6187","title":{"rendered":"How to enable the Linux \/ Bash subsystem in Windows 10"},"content":{"rendered":"<p>Like many people, I was excited to learn about the new Linux subsystem in Windows announced by Microsoft earlier this year (See <a href=\"https:\/\/www.walkingrandomly.com\/?p=6011\">Bash on Windows: The scripting game just changed<\/a>).<\/p>\n<p>Along with others, I&#8217;ve been playing with it on the Windows Insider builds but now that the Windows Anniversary Update has been released, everyone can get in on the action.<\/p>\n<p><strong>Activating the Linux Subsystem in Windows<\/strong><\/p>\n<p>Once you&#8217;ve updated to the Anniversary Update of Windows, here&#8217;s what you need to do.<\/p>\n<p>Open <strong>settings<\/strong><\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6190\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_settings-165x300.png\" alt=\"windows_settings\" width=\"165\" height=\"300\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_settings-165x300.png 165w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_settings-564x1024.png 564w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_settings.png 684w\" sizes=\"auto, (max-width: 165px) 100vw, 165px\" \/><\/a><\/p>\n<p>In\u00a0<strong>settings<\/strong>, click on <strong>Update and Security<\/strong><\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_update.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6191\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_update-300x234.png\" alt=\"windows_update\" width=\"300\" height=\"234\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_update-300x234.png 300w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_update-768x598.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_update-1024x798.png 1024w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_update.png 1592w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In\u00a0<strong>Update and Security,\u00a0<\/strong>click on <strong>For developers<\/strong> in the left hand pane. Then click on\u00a0<strong>Developer mode<\/strong>.<\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_for_developers.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6192\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_for_developers-300x180.png\" alt=\"windows_for_developers\" width=\"300\" height=\"180\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_for_developers-300x180.png 300w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_for_developers-768x460.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_for_developers-1024x614.png 1024w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_for_developers.png 1613w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Take note of the\u00a0<strong>Use developer features<\/strong> warning and click\u00a0<strong>Yes\u00a0<\/strong>if you are happy. Developer mode gives you greater power, and <a href=\"http:\/\/quoteinvestigator.com\/2015\/07\/23\/great-power\/\">with great power comes great responsibility<\/a>.<\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_develper_warning.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6193\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_develper_warning-300x104.png\" alt=\"windows_develper_warning\" width=\"300\" height=\"104\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_develper_warning-300x104.png 300w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_develper_warning-768x267.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_develper_warning-1024x356.png 1024w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_develper_warning.png 1360w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Reboot the machine (may not be necessary here but it&#8217;s what I did).<\/p>\n<p>Search for\u00a0<strong>Features\u00a0<\/strong>and click on\u00a0<strong>Turn Windows features on or off<\/strong><\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_features.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6198\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_features-175x300.png\" alt=\"windows_features\" width=\"175\" height=\"300\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_features-175x300.png 175w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_features-597x1024.png 597w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/windows_features.png 732w\" sizes=\"auto, (max-width: 175px) 100vw, 175px\" \/><\/a><\/p>\n<p>Tick\u00a0<strong>Windows Subsystem for Linux (Beta)\u00a0<\/strong>and click OK<\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.30.08.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6199\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.30.08-300x232.png\" alt=\"Screen Shot 2016-08-05 at 15.30.08\" width=\"300\" height=\"232\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.30.08-300x232.png 300w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.30.08-768x593.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.30.08.png 932w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>When it&#8217;s finished churning, reboot the machine.<\/p>\n<p>Launch <strong>cmd.exe<\/strong><\/p>\n<p><strong><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.36.14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6201\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.36.14-173x300.png\" alt=\"Screen Shot 2016-08-05 at 15.36.14\" width=\"173\" height=\"300\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.36.14-173x300.png 173w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.36.14.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.36.14-592x1024.png 592w\" sizes=\"auto, (max-width: 173px) 100vw, 173px\" \/><\/a><\/strong><\/p>\n<p>Type\u00a0<strong>bash<\/strong>, press enter and follow the instructions<\/p>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.37.58.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6202\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.37.58-300x125.png\" alt=\"Screen Shot 2016-08-05 at 15.37.58\" width=\"300\" height=\"125\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.37.58-300x125.png 300w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.37.58-768x321.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.37.58-1024x428.png 1024w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-15.37.58.png 1086w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The linux subsystem will be downloaded from the windows store and you&#8217;ll be asked to create a Unix username and password.<\/p>\n<p><strong>Try something linux-y<\/strong><\/p>\n<p>The short version of what&#8217;s available is <strong>&#8216;Every userland tool that&#8217;s available for Ubuntu&#8217;<\/strong> with the caveat that anything requiring a GUI won&#8217;t work.<\/p>\n<p>This isn&#8217;t emulation, it isn&#8217;t cygwin, <a href=\"https:\/\/blogs.msdn.microsoft.com\/wsl\/2016\/04\/22\/windows-subsystem-for-linux-overview\/\">it&#8217;s something else entirely<\/a>. It&#8217;s very cool!<\/p>\n<p>The gcc compiler isn&#8217;t installed by default so let&#8217;s fix that:<\/p>\n<pre>sudo apt-get install gcc\r\n<\/pre>\n<p>Using your favourite terminal based editor (I used vi), enter the following &#8216;Hello World&#8217; code in C and call it hello.c.<\/p>\n<pre>\/* Hello World program *\/\r\n\r\n#include\r\n\r\nint main()\r\n{\r\n    printf(\"Hello World from C\\n\");\r\n    \r\n    return(0);\r\n}\r\n<\/pre>\n<p>Compile using gcc<\/p>\n<pre>gcc hello.c -o hello\r\n<\/pre>\n<p>Run the executable<\/p>\n<pre>.\/hello\r\nHello World from C\r\n<\/pre>\n<p>Now, transfer the executable to a modern Ubuntu machine (I just emailed it to myself) and run it there.<\/p>\n<p>That&#8217;s right &#8211; <strong>you just wrote and compiled a C-program on a Windows machine and ran it on a Linux machine<\/strong>.<\/p>\n<p>Now install cowsay &#8212; because you can:<\/p>\n<pre>sudo apt-get install cowsay\r\ncowsay 'Hello from Windows'\r\n ____________________\r\n&lt; Hello from Windows &gt;\r\n --------------------\r\n        \\   ^__^\r\n         \\  (oo)\\_______\r\n            (__)\\       )\\\/\\\r\n                ||----w |\r\n                ||     ||\r\n\r\n<\/pre>\n<p><strong>Update 1:<\/strong><\/p>\n<p>I was challenged by\u00a0<a href=\"https:\/\/twitter.com\/linuxlizard\">@linuxlizard<\/a>\u00a0to do a follow up tutorial that showed how to install the scientific Python stack &#8212; Numpy, SciPy etc.<\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p dir=\"ltr\" lang=\"en\"><a href=\"https:\/\/twitter.com\/walkingrandomly\">@walkingrandomly<\/a> Follow up with HOWTO on installing NumPy, SiPy, Pillow, etc. :-)<\/p>\n<p>\u2014 David Poole (@linuxlizard) <a href=\"https:\/\/twitter.com\/linuxlizard\/status\/761585190103764993\">August 5, 2016<\/a><\/p><\/blockquote>\n<p><script src=\"\/\/platform.twitter.com\/widgets.js\" async=\"\" charset=\"utf-8\"><\/script><\/p>\n<p>It&#8217;s all there :)<\/p>\n<pre>sudo apt-get install python-scipy\r\n<\/pre>\n<p><a href=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-16.42.30.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6205\" src=\"https:\/\/www.walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-16.42.30-300x225.png\" alt=\"Screen Shot 2016-08-05 at 16.42.30\" width=\"300\" height=\"225\" srcset=\"https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-16.42.30-300x225.png 300w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-16.42.30-768x577.png 768w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-16.42.30-1024x769.png 1024w, https:\/\/walkingrandomly.com\/wp-content\/uploads\/2016\/08\/Screen-Shot-2016-08-05-at-16.42.30.png 2046w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Update 2<\/strong><\/p>\n<p>TensorFlow on LinuxOnWindows is also easy:\u00a0<a href=\"http:\/\/www.hanselman.com\/blog\/PlayingWithTensorFlowOnWindows.aspx\">http:\/\/www.hanselman.com\/blog\/PlayingWithTensorFlowOnWindows.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Like many people, I was excited to learn about the new Linux subsystem in Windows announced by Microsoft earlier this year (See Bash on Windows: The scripting game just changed). Along with others, I&#8217;ve been playing with it on the Windows Insider builds but now that the Windows Anniversary Update has been released, everyone can [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,42,66],"tags":[],"class_list":["post-6187","post","type-post","status-publish","format-standard","hentry","category-linux","category-tutorials","category-windows"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-1BN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/6187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6187"}],"version-history":[{"count":7,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/6187\/revisions"}],"predecessor-version":[{"id":6208,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/6187\/revisions\/6208"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}