{"id":199559,"date":"2021-03-11T16:00:20","date_gmt":"2021-03-11T13:00:20","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it\/"},"modified":"2021-03-11T16:00:20","modified_gmt":"2021-03-11T13:00:20","slug":"what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it\/","title":{"rendered":"#What is Windows Subsystem For Linux (WSL), and How Do You Use It? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a256fd4168e0\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a256fd4168e0\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it\/#Not_Just_a_Virtual_Machine\" >Not Just a Virtual Machine<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it\/#Setting_Up_WSL\" >Setting Up WSL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it\/#Using_WSL\" >Using WSL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it-cloudsavvy-it\/#A_Note_On_Filesystems\" >A Note On Filesystems<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What is Windows Subsystem For Linux (WSL), and How Do You Use It? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4765\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/f4202a6e0cbe32fab15139323e145489\/p\/uploads\/2020\/05\/59ea38f7.png\" alt=\"\" width=\"1400\" height=\"600\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Windows Subsystem For Linux (WSL) is a tool provided by Microsoft to run Linux natively on Windows. It\u2019s designed to be a seamless experience, essentially providing a full Linux shell that can interact with your Windows filesystem.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Not_Just_a_Virtual_Machine\"><\/span>Not Just a Virtual Machine<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Lets start with what WSL isn\u2019t\u2014it\u2019s not a full Linux desktop experience that you might get by running Ubuntu in VirtualBox, for example. It does technically use virtualization for performance reasons, but it\u2019s very different from running a full VM. It\u2019s all managed for you, and just provides a simple shell and environment for you to do your work and use familiar bash commands like <code>git<\/code>, <code>ssh<\/code>, and all the other tools that come with the chosen distribution.<\/p>\n<p>Basically, WSL allows you to install a full Linux distribution as an app from the app store. You can simply <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">download<\/a> Ubuntu (or the distro of your choice), install it, and have it available as a app you can launch, or a profile in your terminal to run alongside CMD or Powershell.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10064\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/af7e0d96418e892774a58e8e82af7eb7\/p\/uploads\/2021\/03\/29fc6c49-1.png\" alt=\"\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>While the simplest explanation is that it \u201clets you run bash on Windows,\u201d it\u2019s more than just a shell; you can install programs using <code>apt<\/code>\u00a0and customize it like a regular Linux instance.<\/p>\n<p>WSL is intended to give developers and bash veterans the Linux shell experience despite having to use Windows as the primary OS. It offers the best of both worlds by allowing you to run Windows apps, like Visual Studio, alongside a Linux shell for easier command line access.<\/p>\n<p>Microsoft offers two version of WSL: version 1, and version 2. WSL 2 uses a virtual machine, and uses a full Linux kernel built and shipped with Windows.\u00a0 WSL 1 is older, and <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">general<\/a>ly a lot slower, but does have better performance when working across filesystems, e.g. accessing Windows files from Linux, and vice versa. We recommend WSL 2 for most operations, as it\u2019s faster and works much better with tools like Docker.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Setting_Up_WSL\"><\/span>Setting Up WSL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>WSL is an optional Windows feature, so you\u2019ll need to turn it on. Open up Powershell as Administrator via the start menu:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10091\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/e0360aa0c1308b4eeab109c65e2bc6a1\/p\/uploads\/2021\/03\/6f0a2558.png\" alt=\"\" width=\"700\" height=\"324\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Then, turn it on:<\/p>\n<pre>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux<\/pre>\n<p>You will need to restart your machine to apply the changes. After that, you can open up the Windows Store and search for \u201cWSL,\u201d which will display the available distros:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10092\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/b093bab6b959ffc76d0a1ab416e2aa59\/p\/uploads\/2021\/03\/97cf7db3.png\" alt=\"\" width=\"700\" height=\"349\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The first time you run it, you\u2019ll be prompted to set up your username and password for the instance. These are just for Linux, and don\u2019t need to match your windows password at all.<\/p>\n<p>The first one you install should be set as your default, but if you install multiple, you will need to set the default manually. You can manage WSL via the <code>wsl<\/code>\u00a0command in Powershell. For example, listing all currently installed versions:<\/p>\n<pre>wsl --list<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10093\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/bb2d194c19aff488f95e17eb099735a4\/p\/uploads\/2021\/03\/7bf34d4d.png\" alt=\"\" width=\"495\" height=\"174\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Then, you can set your default WSL distro with the following command, which can also be used to swap between WSL 1 and 2\u2033<\/p>\n<pre>wsl --set-version Ubuntu-20.04 2<\/pre>\n<p>You can also set a preferred WSL version (1 vs. 2) for all future installs:<\/p>\n<pre>wsl --set-default-version 2<\/pre>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Using_WSL\"><\/span>Using WSL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can open WSL in a few different ways. The easiest is to just press Windows and type \u201cwsl,\u201d which will automatically run <code>wsl.exe<\/code>\u00a0and open your default distro.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10095\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/a23e94b6e496ce74b3671d06e71b93e3\/p\/uploads\/2021\/03\/f1e0568b.png\" alt=\"\" width=\"389\" height=\"160\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10096\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/b565de7249693de89ea6cd3d30ea9ad8\/p\/uploads\/2021\/03\/aa1a2b27.png\" alt=\"\" width=\"625\" height=\"195\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This is just a basic terminal window though; if you\u2019re using Microsoft\u2019s new Terminal App, which we highly recommend, your WSL versions can be accessible via a dropdown menu (alongside any SSH profiles you may have set up):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10064\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/af7e0d96418e892774a58e8e82af7eb7\/p\/uploads\/2021\/03\/29fc6c49-1.png\" alt=\"\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>In case you want to set up a new profile, the config for this is the following:<\/p>\n<pre>{&#13;\n    \"guid\": \"{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}\",&#13;\n    \"hidden\": false,&#13;\n    \"name\": \"Ubuntu\",&#13;\n    \"source\": \"Windows.Terminal.Wsl\",&#13;\n    \"fontFace\": \"RobotoMono Nerd Font\",&#13;\n    \"fontSize\" : 10,&#13;\n    \"cursorColor\" : \"#FFFFFF\",&#13;\n    \"cursorShape\" : \"bar\",&#13;\n    \"fontFace\" : \"RobotoMono Nerd Font\",&#13;\n    \"acrylicOpacity\" : 0.75,&#13;\n    \"closeOnExit\" : true,&#13;\n    \"colorScheme\" : \"Campbell\"&#13;\n},<\/pre>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"A_Note_On_Filesystems\"><\/span>A Note On Filesystems<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Your Linux filesystem is mounted at <code>\/<\/code>, as per usual. Windows is located at <code>\/mnt\/c\/<\/code>, or whichever drive letter is your default (additional drives are mounted as well).<\/p>\n<p>Since this is all virtual, your Linux files are of course stored on the drive itself. For WSL 1, these are stored with a simple folder. WSL 2 changes things though, and stores files as a virtual hard disk image, or VHDX.<\/p>\n<p>You can find these images at the following path, and while they can be mounted while the distro is unregistered, we don\u2019t recommend messing with them from the Windows side.<\/p>\n<pre>%USERPROFILE%AppDataLocalPackagesCanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgscLocalState<\/pre>\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/10058\/what-is-windows-subsystem-for-linux-wsl-and-how-do-you-use-it\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What is Windows Subsystem For Linux (WSL), and How Do You Use It? \u2013 CloudSavvy IT&#8221; Windows Subsystem For Linux (WSL) is a tool provided by Microsoft to run Linux natively on Windows. It\u2019s designed to be a seamless experience, essentially providing a full Linux shell that can interact with your Windows filesystem. Not Just&#8230;<\/p>\n","protected":false},"author":1,"featured_media":199560,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/f4202a6e0cbe32fab15139323e145489\/p\/uploads\/2020\/05\/59ea38f7.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-199559","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/199559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=199559"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/199559\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/199560"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=199559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=199559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=199559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}