How To Run Linux Code on Windows with WSL 2 & VS Code

Поделиться
HTML-код
  • Опубликовано: 4 июл 2024
  • With the Windows Subsystem for Linux (WSL) you can install your favorite Linux distribution and connect it with Visual Studio Code to run Linux-first projects on Windows.
    My FREE programming apps:
    - apps.apple.com/app/id659282498
    - play.google.com/store/apps/de...
    My FREE TypeScript Course:
    - typescript.tv/
    Timeline:
    00:00 - Intro
    00:39 - When to use the Windows Subsystem for Linux (WSL)?
    01:42 - What is the Windows Subsystem for Linux (WSL)?
    02:17 - Installing WSL 2
    02:47 - Installing Ubuntu on Windows
    03:47 - Running Ubuntu on Windows 10
    04:13 - Accessing files on Linux from Windows
    05:14 - Accessing files on Windows from Linux
    06:08 - Connect Visual Studio Code with Ubuntu (Remote WSL)
    07:37 - Share credentials between Windows and Linux
    10:07 - Build Linux-first project on Windows
    11:05 - Use Docker with WSL 2
    13:13 - Closing Note
    Follow Us:
    🌐 typescript.tv/​
    🐦 / typescripttv
    📺 / typescripttv​
    Commands:
    ➜ Enter "wsl --install" in your PowerShell to install the Windows Subsystem for Linux
    ➜ Enter "wsl --status" in your PowerShell to check your installed WSL version
    ➜ Enter "\\wsl$\" in your File Explorer to see your Linux drives
    Resources:
    ➜ Windows Subsystem for Linux Documentation: docs.microsoft.com/windows/wsl/
    ➜ Docker Desktop with WSL 2: docs.docker.com/desktop/windo...
    ➜ Ubuntu on WSL: ubuntu.com/wsl
    ➜ Visual Studio Code Remote - WSL: marketplace.visualstudio.com/...
    ➜ Enable Hardware-assisted virtualization: typescript.tv/hands-on/docker...
    Hashtags:
    #TypeScript #Linux #WSL #Windows #Ubuntu
  • НаукаНаука

Комментарии • 134

  • @TypeScriptTV
    @TypeScriptTV  10 месяцев назад

    If you have problems activating hardware-assisted virtualization (required for WSL2), this guide will help you: typescript.tv/hands-on/docker-desktop-hardware-assisted-virtualization/ 📖

  • @kevincrowe7832
    @kevincrowe7832 4 месяца назад +2

    Really appreciate this video. the "rm -rf" command was specifically the problem I was having and I'm happy you brought it up within the first minute or so of the video.

  • @domnicdodeva3290
    @domnicdodeva3290 7 месяцев назад +2

    This video helped a lot to understand how visual studio code, wsl works. Thank you for helping out

  • @LibraryOfTheOligarchs
    @LibraryOfTheOligarchs 4 месяца назад +1

    extremely helpful! Appreciate you!

  • @bulbousdude
    @bulbousdude Год назад +2

    Excellent video! This is exactly what I was looking for. Thank you!

    • @TypeScriptTV
      @TypeScriptTV  Год назад +2

      I was looking for a good tutorial on WSL 2 myself for a very long time. Happy I could support you with this one! Best, Benny

  • @user-qv2sh6wm6j
    @user-qv2sh6wm6j 7 месяцев назад +1

    Amazing video !!
    Thanks a lot!

  • @matiasrisso5917
    @matiasrisso5917 Год назад +3

    Amazing, detailed but easy to follow and understand!

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Thank you! What a great feedback. ⭐ Best, Benny

  • @vladimirastrelin1719
    @vladimirastrelin1719 Год назад +1

    Thanks, Sir. Your tutorial is comprehensive and pretty thorough !

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      You're welcome! I'm glad I could help. 😀 Best, Benny

  • @gregmasters7420
    @gregmasters7420 Год назад +6

    What a great video. Thank you for taking the time to help a novice like me to get this running!

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      You are very welcome! We were all beginners and will be beginners again with the next evolution of software. 💫 Best, Benny

  • @pkn8707
    @pkn8707 Год назад +11

    Thanks Benny! The way you have structured the topics , it is really easy for a beginner to grasp it in one go. If a beginner can understand then anyone can do it.

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      It's very nice of you to tell me that. Wishing you a lot of fun using the Windows Subsystem for Linux! 👍 Best, Benny

  • @quachbinh0503
    @quachbinh0503 Год назад +1

    Exactly what I needed. Thank you so much.

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Happy to help and thanks for leaving a comment. 👍 Best, Benny

  • @adefrawy
    @adefrawy 2 года назад +1

    Great video, exactly what I needed. Thanks

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      Happy to help! Let's rock Linux together! 🚀

  • @user-rf2of2kw4p
    @user-rf2of2kw4p Год назад +1

    Thanks Benny! Great Video!

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Happy to help! All the best from Berlin. 🙌

  • @thomasfsr
    @thomasfsr 5 месяцев назад +4

    You promised nothing and delivered everything! Thank you bro

    • @TypeScriptTV
      @TypeScriptTV  5 месяцев назад

      Thank you!! I really like working with WSL2. 🙂

  • @Jay2Ops
    @Jay2Ops Год назад +1

    Thanks for the video. I had toiled for hours.

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      Thank you for your comment. Producing this video becomes totally worth it when we can save precious hours in a developer's life. 😀 Best, Benny

  • @forexmeter3900
    @forexmeter3900 Год назад +1

    Very well explained, thank you!

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Thank you! Always happy to help. ☺ Best, Benny

  • @vitaminsee
    @vitaminsee Год назад +1

    thank you, this was very informative and easy to follow.

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Thank you so much for your kind words. All the best for your coding journey!

  • @capthat8901
    @capthat8901 5 месяцев назад +1

    Thank you!

  • @Zydres_Impaler
    @Zydres_Impaler Месяц назад +1

    Thanks a lot bro

  • @_indrid_cold_
    @_indrid_cold_ 6 месяцев назад +1

    Brilliant explanations!

    • @TypeScriptTV
      @TypeScriptTV  6 месяцев назад

      Thank you very much! ☺ Comments like yours are the currency I crave. 😁

  • @jinxinglim1855
    @jinxinglim1855 2 года назад +1

    Really great video. thank you!

    • @TypeScriptTV
      @TypeScriptTV  2 года назад

      Thanks for taking the time and posting a comment! 😊

  • @johnkrumpotick8659
    @johnkrumpotick8659 Год назад +1

    You answered my questions, thank you.

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Cool. Thanks for letting me know. 😊

  • @tur8008
    @tur8008 Год назад +1

    That's coool! Thank you!

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Glad you like it! Fist bump! 🤜🤛

  • @es7729
    @es7729 11 месяцев назад +1

    Thank you!!!

  • @IT__Amber
    @IT__Amber Год назад +1

    helpful late at night👍

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Happy to hear. Wishing you a great coding session! 🦉⌨

  • @kritikjain3617
    @kritikjain3617 Год назад +1

    Thanks man!

  • @chacquito1862
    @chacquito1862 2 года назад +4

    This was super helpful and clear! Very appreciated, thank you!

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      Thank you for your kind words. 🙇 Best, Benny

  • @joemarcardio525
    @joemarcardio525 Год назад +1

    Thank you sir!

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      My pleasure! 🙂 Greetings from Berlin.

  • @mohamedmagdy2816
    @mohamedmagdy2816 Год назад +1

    Good explanation, i really needed this video since i would start in kubernates project.

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Happy to hear! Are you working on an Open Source project? :)

  • @BrazilianDev
    @BrazilianDev 2 года назад +1

    Very useful.

  • @hazard9064
    @hazard9064 7 месяцев назад +1

    thank you so much

  • @srinivasmekala1189
    @srinivasmekala1189 2 года назад +4

    Thank U for posting this video.... I installed WSL recently and stopped using coz I can't see the files I created through ubuntu in my file explorer. You helped me a lot. Thank you very much.

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +3

      My pleasure. On Windows 11 the WSL 2 even supports Linux GUI apps. Wishing you lots of fun using it! Benny

  • @aomo5293
    @aomo5293 Год назад +1

    Thank you Bro, you helped me fixing one issue; may ALLAH gives you the best;

  • @DanielSchmidt-le4og
    @DanielSchmidt-le4og 2 года назад +5

    Great video, thanks Benny! Your tutorial video helped me a lot 🙌

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +3

      Happy to help! Windows 11 Build 22000 or higher even supports running Linux GUI apps: docs.microsoft.com/windows/wsl/tutorials/gui-apps

    • @AnasthassiaMurillo
      @AnasthassiaMurillo Год назад +1

      @@TypeScriptTV do you recommend to update to Windows 11?
      I recently bought a Huawei laptop with Ryzen 5 5600 CPU and I've heard Windows 11 doesn't work so well with Ryzen processors and that makes me hesitant about updating to Windows 11.

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      @@AnasthassiaMurillo I have upgraded to Windows 11 a while ago and it's working well for me. 🙂 My desktop PC has an AMD Ryzen 7 3700X processor.

    • @AnasthassiaMurillo
      @AnasthassiaMurillo Год назад

      @@TypeScriptTV thank you for your quick reply!}

  • @kingkiller4630
    @kingkiller4630 5 месяцев назад +1

    almost lost em at the free halo infinite im glad you pulled through and kept on with the tutorial

  • @YouAreTheRaidBoss
    @YouAreTheRaidBoss Год назад +2

    Stark Bruder!

  • @garimasingh8530
    @garimasingh8530 2 месяца назад

    Thanks a million

  • @M_SHEHU
    @M_SHEHU Месяц назад +1

    Thanks man

  • @BlancheNuit
    @BlancheNuit Год назад +1

    thank you this is very useful. I was getting depressed (big word) writing code on virtualbox(because needed linux environment) because the lagg was getting to my nerves.
    This is going to make my life so much happier

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      VirtualBox lag getting you down? No worries, my friend... armed with WSL, you're about to get lightning-fast speeds! 🚀 Best, Benny

    • @BlancheNuit
      @BlancheNuit Год назад

      @@TypeScriptTV I just got WSL (+ ubuntu) and its extension on VSCode and it's amazing !!

  • @abraund
    @abraund 8 месяцев назад +1

    Win+v, well that one has evaded me for a long time. Great guide, cannot believe how easy it is.

    • @TypeScriptTV
      @TypeScriptTV  8 месяцев назад

      Happy that it helped you! 👍 Please share my channel if you would like to support it. 😃

    • @abraund
      @abraund 8 месяцев назад

      @@TypeScriptTV and yet does anyone messing around with Linux on a Saturday afternoon have a social media following 🤔 good luck either way!

  • @TechIdeasbd
    @TechIdeasbd 2 года назад +1

    Good job mate.

    • @TypeScriptTV
      @TypeScriptTV  2 года назад

      Thank you very much! I hope my tutorial saves some people from hours of debugging. :D Best, Benny

  • @dianaawino
    @dianaawino 2 года назад +2

    Thanks alot....some really insightful info for beginners like myself👏👏👏👏👏

    • @TypeScriptTV
      @TypeScriptTV  2 года назад

      Happy to hear that this was helpful for you. Are you also programming with TypeScript?

    • @dianaawino
      @dianaawino 2 года назад

      @@TypeScriptTV yes...i'm quite new to the whole typescript experience.... and so excited🤓🤓 about this programming journey

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      @@dianaawino that's nice to hear! I am currently releasing one tutorial per week. Tomorrow I will upload a video which explains generic functions. If you like, you can subscribe to this channel to be informed about it. Best, Benny

    • @dianaawino
      @dianaawino 2 года назад

      @@TypeScriptTV sure thing..thanks

  • @aiinstinct
    @aiinstinct 2 года назад

    great! thank you

    • @TypeScriptTV
      @TypeScriptTV  2 года назад

      You are welcome. Happy to help. 🙂 Have a great day! Best, Benny

  • @guidoperezmoro8331
    @guidoperezmoro8331 День назад +1

    You're awesome dude

    • @TypeScriptTV
      @TypeScriptTV  13 часов назад

      Haha, thank you! But what about my video? 😅

  • @lucareneambos3438
    @lucareneambos3438 2 года назад +1

    Great Video!!! 🔥🔥🔥 Love the German accent! ♥

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      I cannot hide my roots. 😂 Happy that you liked the video. 😊 Benny

  • @brunosoltoo
    @brunosoltoo 9 месяцев назад +1

    that's awesome! I thought It would be necessary to install vscode in the wsl distro too.

  • @devij230
    @devij230 2 года назад +3

    Great

  • @Salah-YT
    @Salah-YT Год назад +2

    thank u so much bro because u did help me a lot I did SUB + LIKE for u thank so much

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      That's great! Happy to hear. 🙂🙂🙂

  • @user-uq7qi1wi9o
    @user-uq7qi1wi9o 6 месяцев назад +1

    👍

  • @jefersonlima3524
    @jefersonlima3524 Год назад +1

    Great video. Helped me a lot configuring my environment. A question for you: How you got that smooth fonts on Windows? They look a lot like Linux font rendering, not ClearType.

    • @TypeScriptTV
      @TypeScriptTV  Год назад +1

      Hey, happy that you like my video. I actually have "ClearType" turned on and I am using a 150% (sometimes 175%) scaling in my "Display" settings. Hope this answers your question! Best, Benny

    • @jefersonlima3524
      @jefersonlima3524 Год назад

      @@TypeScriptTV Thanks. It's answered.😁

  • @lapracity884
    @lapracity884 8 месяцев назад +1

    Super helpful! why are u so close to the camera tho

    • @TypeScriptTV
      @TypeScriptTV  8 месяцев назад

      I only had a fixed focal length lens available back at that time. 🫥

  • @miture0502
    @miture0502 Год назад

    Hi, is it possible to reopen in container when using vscode plus WSL? When reopening in container, vscode automatically returns to the local machine rather in the Linux environment.

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Good question, does this extension matches your use case? marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers

  • @Calypso694
    @Calypso694 4 месяца назад

    can you use man pages with this and other terminal commands like make,cd,ls, etc etc etc.

    • @TypeScriptTV
      @TypeScriptTV  4 месяца назад

      Yes, you will get a complete Ubuntu terminal environment: apps.microsoft.com/detail/9pdxgncfsczv

  • @supernova-4420
    @supernova-4420 4 месяца назад

    anybody know how to make .code-workspace files open a wsl workspace?

  • @rishiaman2288
    @rishiaman2288 5 месяцев назад

    9:58 i dont have an .ssh directory

  • @BilalKas
    @BilalKas 2 года назад +1

    Danke, brauche fork und pipes für die Uni und mit WSL klappt das mega, wollte keine VPN oder eine richtige VM nutzen..

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      Freut mich, wenn dir das Video helfen konnte! Das WSL ist eine gute Alternative zu Cygwin, MinGW-w64 und anderen Tools. 🙂 Gruß, Benny

  • @xyz-123
    @xyz-123 Год назад

    after installing it is power limiting the cpu while running the codes on windows when iam unplugged to power in my laptop. For this reason my vs code in windows is running at restricted wattage to the cpu hence slowly. What can I do now? Note that there no problem when Iam plugged in.

  • @sorcererstone3303
    @sorcererstone3303 Год назад

    @5:14, Benny created a folder within the benny's directory for demonstration purpose.
    Can someone tell me where (which directory/folder) most people likely to place their development project in (and can be access through windows explorer and visual studio code)?
    I can create any new directory under Ubuntu directory (@ 4:37).
    Do I have to place all my project folders within one of the pre-existing folders/directories as shown in 4:37?

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Accessing files with WSL/Ubuntu from your Windows drive (example: /mnt/c) will be very slow. When you wish to access files from WSL in VS Code, then I suggest doing that inside your Ubuntu home directory (example: \\wsl.localhost\Ubuntu\home\bennycode\dev). Best, Benny

    • @sorcererstone3303
      @sorcererstone3303 Год назад +1

      @@TypeScriptTV Thank you for the tips.
      When I read MS's docker desktop doc, it too emphasis not to use windows drive for development when using WSL2 for performance issues that you just mentioned.
      So, I am going to place all my projects in this dev directory you suggested. There are going to be a lot of such folders inside this dev directories!!

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      @@sorcererstone3303 great! Do you have a link to the Docker docs to share?

  • @dips_07
    @dips_07 11 месяцев назад

    Great video 🤟...one concern is how to auto complete once i type on tab key in wsl terminal..for example want to go to "Home" folder once i type "H" and then click on "tab key" it should be auto complete to "Home"... please help with this

    • @TypeScriptTV
      @TypeScriptTV  11 месяцев назад

      I'm afraid that this behavior is only functional in Windows' File Explorer and does not work in a Shell environment. 🤔

    • @dips_07
      @dips_07 11 месяцев назад

      Okay 👍

  • @rishiaman2288
    @rishiaman2288 5 месяцев назад

    11:28 i dont have nph

  • @kirteek5334
    @kirteek5334 2 года назад

    I watched this video just after I was done installing Ubuntu os 🥲 ... Is WSL will fulfill the requirements that one Linux based project requires.. coz setting up an whole environment in Ubuntu as well. For coding and stuf is again an hectic work I see...

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      WSL is a great option to get up and running with Linux projects on Windows. With Windows 11 you can even run GUI applications. 😲

  • @duartebrs
    @duartebrs 9 месяцев назад +1

    THANKS A LOT JESUS I LOVE YOU

  • @muazulislam398
    @muazulislam398 Год назад

    I am getting access denied, check permission when I try to open ubuntu/home/username directory

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Yikes! On which version of Windows are you running? 🪟

  • @jimmyolano929
    @jimmyolano929 2 года назад +4

    2:29 wsl --status

    • @TypeScriptTV
      @TypeScriptTV  2 года назад +1

      You can use "wsl --status" to check your currently installed WSL version. If no version is found, you can install one using "wsl --install". I added these commands to the description of this tutorial. Best, Benny

  • @cocogoat1029
    @cocogoat1029 4 месяца назад

    I'm trying to learn assembly as a complete beginner to low level programming and every content creator is using some fancy CLI program while using Linux system calls on their program on their tutorials. I would've been more of a nightmare without AI tools.

  • @shiroclown6131
    @shiroclown6131 Год назад

    Why is vscode shared, but nodejs is not shared?

    • @TypeScriptTV
      @TypeScriptTV  5 месяцев назад

      It’s because VS Code is build by Microsoft and they put effort into sharing it with the WSL. Node.js is separate and only lives within the Ubuntu installation.

    • @shiroclown6131
      @shiroclown6131 5 месяцев назад

      @@TypeScriptTV wow that is not an expected answer. Thanks.

  • @xyz-123
    @xyz-123 Год назад

    is it WSL 1 or WSL 2

  • @bluebull399
    @bluebull399 Год назад

    I still struggle to understand what docker desktop actually is or why it's needed.
    I use docker compose on WSL Ubuntu which I use to spin up demons of my app in Ubuntu.
    Can docker desktop do this? I run multiple instances of the app and am always spinning up and down those. A point and click interface would be a lot nicer than typing out Linux commands.

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      Docker Desktop is just a GUI on top of Docker. It will allow you to manage your volumes and images. If you're already comfortable using Docker Compose in WSL Ubuntu, it might be more efficient to continue using it though.

  • @Capitan_Mega
    @Capitan_Mega Год назад

    OK but I can't even download anything on my Microsoft store for 1 entire month... Nothing can fix it bruh NOTHING I SEEN 20 VIDEOS of how to fix my Microsoft store and NOTHING

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      That's sad to hear but I just found a guide on how to install WSL2 and a Linux distribution without using the Microsoft Store: stackoverflow.com/a/64872285/451634 - Hope it works for you! 🍀🍀

  • @MJLee-wl6kt
    @MJLee-wl6kt 9 месяцев назад

    Is "Remote WSL" now rename to "WSL" ? I can't see "remote WSL" anymore.

    • @TypeScriptTV
      @TypeScriptTV  9 месяцев назад

      Probably. Have you tried just using "WSL"?

  • @ninjanape
    @ninjanape Год назад

    I would be able to hear better if the camera was a bit closer to your face

    • @ninjanape
      @ninjanape Год назад +1

      great video though, thanks :D :D

    • @TypeScriptTV
      @TypeScriptTV  Год назад

      @@ninjanape haha, I hope my close-up didn't startle you. I'm using a Sigma 30mm fixed focal length lens, so zooming is a bit limited. Nevertheless, I'm glad you enjoyed the video! 😀