{"id":53080,"date":"2019-11-23T00:00:00","date_gmt":"2019-11-22T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux"},"modified":"2020-02-18T14:00:56","modified_gmt":"2020-02-18T11:00:56","slug":"krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux","title":{"rendered":"Cool life hacks for working with WSL (Windows Subsystem for Linux)","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>I am deeply immersed in WSL (Windows Subsystem for Linux), and now that\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/www.hanselman.com\/blog\/RubyOnRailsOnWindowsIsNotJustPossibleItsFabulousUsingWSL2AndVSCode.aspx\">WSL2<\/a><\/noindex>\u00a0it is available in\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/insider.windows.com\/\">Windows Insiders<\/a><\/noindex>, it's a great time to truly explore the available options. A very interesting feature I found in WSL is the ability to 'seamlessly' move data between worlds. This is not an experience you can easily achieve with full virtual machines, and it speaks to the tight integration of Linux and Windows.<\/p>\n<p>Below are some interesting things you can do by mixing peanut butter and chocolate!<\/p>\n<p><img decoding=\"async\" alt=\"Cool life hacks for working with WSL (Windows Subsystem for Linux)\" src=\"\/wp-content\/uploads\/2019\/11\/523fb960bf2c400a459f8949e32d49a2.jpg\" style=\"display:block;margin: 0 auto;\" \/><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Run Windows Explorer from Linux and access your distribution files<\/h2>\n<p>\nWhen you are in the WSL \/ bash command line and want visual access to your files, you can run 'explorer.exe .' from your current directory, and you'll get a Windows Explorer window where your Linux files will be delivered to you through the plan9 local network server.<\/p>\n<p><img decoding=\"async\" alt=\"Cool life hacks for working with WSL (Windows Subsystem for Linux)\" src=\"\/wp-content\/uploads\/2019\/11\/c14a48828cbb4d31990a9cbccc0b4ae5.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h2>Use real Linux commands (not Cygwin) from Windows<\/h2>\n<p>\nI've written about this before, but now there are aliases for PowerShell functions, <noindex><a rel=\"nofollow\" href=\"https:\/\/www.hanselman.com\/blog\/AWonderfullyUnholyAllianceRealLinuxCommandsForPowerShellWithWSLFunctionWrappers.aspx\">which allow you to use real Linux commands<\/a><\/noindex>\u00a0from inside Windows.<\/p>\n<p>You can call any Linux command directly from DOS\/Windows\/whatever by putting it after WSL.exe like this.<\/p>\n<pre><code class=\"plaintext\">C:temp&gt; wsl ls -la | findstr \"foo\"\n-rwxrwxrwx 1 root root     14 Sep 27 14:26 foo.bat\n\nC:temp&gt; dir | wsl grep foo\n09\/27\/2016  02:26 PM                14 foo.bat\n\nC:temp&gt; wsl ls -la &gt; out.txt\n\nC:temp&gt; wsl ls -la \/proc\/cpuinfo\n-r--r--r-- 1 root root 0 Sep 28 11:28 \/proc\/cpuinfo\n\nC:temp&gt; wsl ls -la \"\/mnt\/c\/Program Files\"\n...contents of C:Program Files...<\/code><\/pre>\n<p>\nWindows executables can be called\/runned from WSL\/Linux, as the Windows path is in the $PATH before Windows. All you need to do is explicitly call them with .exe at the end. Here's how 'Explorer.exe' works. You can also do notepad.exe or any other file.<\/p>\n<h2>Launch Visual Studio Code and access your Linux applications natively on Windows<\/h2>\n<p>\nYou can run 'code.' while in a folder in WSL, and you will be prompted to install\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/code.visualstudio.com\/blogs\/2019\/09\/03\/wsl2?WT.mc_id=-blog-scottha\">VS Remote extensions.<\/a><\/noindex>. This effectively splits Visual Studio Code in half and runs a 'headless' VS Code Server in Linux with the VS Code client in the Windows world.<\/p>\n<p>You also need to install\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/code.visualstudio.com\/download?WT.mc_id=-blog-scottha\">Visual Studio Code<\/a><\/noindex>\u00a0and <noindex><a rel=\"nofollow\" href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode-remote.remote-wsl&amp;WT.mc_id=-blog-scottha\">the Remote - WSL extension.<\/a><\/noindex>. Optionally, install\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/www.microsoft.com\/p\/windows-terminal-preview\/9n0dx20hk701?WT.mc_id=-blog-scottha\">the beta version of Windows Terminal<\/a><\/noindex>\u00a0for a better terminal experience on Windows.<\/p>\n<p>Here's a great collection of articles from the Windows Command Line blog.<\/p>\n<ul>\n<li>Part 1\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/devblogs.microsoft.com\/commandline\/take-your-linux-development-experience-in-windows-to-the-next-level-with-wsl-and-visual-studio-code-remote\/?WT.mc_id=-blog-scottha\">Elevate your Linux development experience on Windows with WSL and Visual Studio Code Remote.<\/a><\/noindex><\/li>\n<li>Part 2\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/devblogs.microsoft.com\/commandline\/an-in-depth-tutorial-on-linux-development-on-windows-with-wsl-and-visual-studio-code\/?WT.mc_id=-blog-scottha\">In-depth Guide to Linux Development for Windows with WSL and Visual Studio Code<\/a><\/noindex><\/li>\n<li>Part 3\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/devblogs.microsoft.com\/commandline\/tips-and-tricks-for-linux-development-with-wsl-and-visual-studio-code\/?WT.mc_id=-blog-scottha\">Tips and Recommendations for Linux Development Using WSL and Visual Studio Code<\/a><\/noindex><\/li>\n<\/ul>\n<p>\nHere are the benefits of WSL 2<\/p>\n<ul>\n<li>Virtual machines are resource-intensive and create a very isolated experience.<\/li>\n<li>The original WSL was quite 'connected' but had significantly lower performance compared to VMs.<\/li>\n<li>WSL 2 offers a hybrid approach with lightweight VMs, a fully connected interface, and high performance.<\/li>\n<\/ul>\n<p><\/p>\n<h2>Run multiple Linux instances in seconds<\/h2>\n<p>\nHere I use \"wsl --list --all\", and my system already has three Linux distributions.<\/p>\n<pre><code class=\"plaintext\">C:Usersscott&gt; wsl --list --all\nWindows Subsystem for Linux Distributions:\nUbuntu-18.04 (Default)\nUbuntu-16.04\nPengwin<\/code><\/pre>\n<p>\nI can easily launch them and also assign profiles so they appear in my Windows Terminal.<\/p>\n<h2>Run X Windows Server on Windows with Pengwin<\/h2>\n<p>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/www.pengwin.dev\/\">Pengwin<\/a><\/noindex>\u00a0\u2014 this is a special Linux distribution of WSL that is very cool. You can get it at\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/afflnk.microsoft.com\/c\/1291904\/433017\/7593?u=https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fp%2Fwlinux%2F9nv1gv1pxz6p&amp;WT.mc_id=-blog-scottha\">Windows Store<\/a><\/noindex>. Combine Pengwin with <noindex><a rel=\"nofollow\" href=\"https:\/\/www.bing.com\/rebates\/welcome?url=https%3a%2f%2fwww.microsoft.com%2fen-us%2fp%2fx410%2f9nlp712zmn9q&amp;murl=http%3a%2f%2fclick.linksynergy.com%2fdeeplink%3fid%3dmsYS1Nvjv4c%26afsrc%3d1%26mid%3d24542%26murl%3dhttps%253a%252f%252fwww.microsoft.com%252fen-us%252fp%252fx410%252f9nlp712zmn9q%26u1%3d&amp;id=Microsoft&amp;ra=8%&amp;hash=1b8c84b51e92d8f9b2be366b93a65d2e093ee6ef2f98f699b82b26d8d905970b\">X Server, like X410<\/a><\/noindex>, and you'll have a really great integrated system.<\/p>\n<h2>Easily move WSL distributions between Windows systems.<\/h2>\n<p>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/anaisbetts\/status\/1194386477855019008\">Ana Betts highlights this amazing technique<\/a><\/noindex>that lets you easily transfer your perfect WSL2 distribution from one machine to <i>n<\/i> another.<\/p>\n<pre><code class=\"plaintext\">wsl --export MyDistro .\/distro.tar\n\n# store it somewhere, Dropbox, OneDrive, somewhere else\n\nmkdir ~\/AppData\/Local\/MyDistro\nwsl --import MyDistro ~\/AppData\/Local\/MyDistro .\/distro.tar --version 2 <\/code><\/pre>\n<p>\nThat's it. Get the perfect Linux setup synchronized across all your systems.<\/p>\n<h2>Use the Windows Git Credential Provider inside WSL<\/h2>\n<p>\nAll the mentioned features culminate\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/blog.anaisbetts.org\/using-github-credentials-in-wsl2\/\">in this cool post from Ana Betts<\/a><\/noindex>, where she integrates\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/blog.anaisbetts.org\/using-github-credentials-in-wsl2\/\">the Windows Git Credential Provider in WSL<\/a><\/noindex>, turning \/usr\/bin\/git-credential-manager into a shell script that invokes the Windows git creds manager. Brilliant. This would only be possible with clean and tight integration.<\/p>\n<p>Give it a try, install WSL,\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/www.hanselman.com\/blog\/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx\">Windows Terminal<\/a><\/noindex>, and create\u00a0<noindex><a rel=\"nofollow\" href=\"https:\/\/www.hanselman.com\/blog\/SettingUpAShinyDevelopmentEnvironmentWithinLinuxOnWindows10.aspx\">a brilliant Linux environment on Windows.<\/a><\/noindex>.<br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/microsoft\/blog\/476026\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u042f \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d \u0432 WSL (Windows Subsystem \u0434\u043b\u044f Linux), \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430\u00a0WSL2\u00a0\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u00a0Windows Insiders, \u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438. \u041e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0444\u0438\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0430\u0448\u0435\u043b \u0432 WSL, \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u00ab\u0447\u0438\u0441\u0442\u043e\u00bb \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u043c\u0438\u0440\u0430\u043c\u0438. \u042d\u0442\u043e \u043d\u0435 \u0442\u043e\u0442 \u043e\u043f\u044b\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u0438 \u043e\u043d \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u0435\u0441\u043d\u043e\u0439 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-53080","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u042f \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d \u0432 WSL (Windows Subsystem \u0434\u043b\u044f Linux), \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041a\u0440\u0443\u0442\u044b\u0435 \u043b\u0430\u0439\u0444\u0445\u0430\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 WSL (\u041f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0430 Windows \u0434\u043b\u044f Linux ) | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u042f \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d \u0432 WSL (Windows Subsystem \u0434\u043b\u044f Linux), \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-11-22T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T11:00:56+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Cool Hacks for Working with WSL (Windows Subsystem for Linux) | ProHoster","description":"I am deeply immersed in WSL (Windows Subsystem for Linux), and now that","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041a\u0440\u0443\u0442\u044b\u0435 \u043b\u0430\u0439\u0444\u0445\u0430\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 WSL (\u041f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0430 Windows \u0434\u043b\u044f Linux ) | ProHoster","og:description":"\u042f \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d \u0432 WSL (Windows Subsystem \u0434\u043b\u044f Linux), \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/krutye-lajfhaki-dlya-raboty-s-wsl-podsistema-windows-dlya-linux","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-11-22T21:00:00+00:00","article:modified_time":"2020-02-18T11:00:56+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"53080","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 05:59:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 20:31:29","updated":"2026-01-24 05:59:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/53080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=53080"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/53080\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=53080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=53080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=53080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}