24 October 2022

Window Subsystem for Linux

Scott Hanselman with some nice tips on how to use WSL, and other Windows tips.

  • Use Windows Terminal instead of command prompt
    • it knows about the various shells, eg command prompt, PowerShell, WSL Linux distros
    • right-click to split window
  • Oh My Posh
    • a prompt theme engine for any shell
    • looked nice when he used it, but I won’t use it because it needs setup for each type of prompt, and I prefer naked prompts
  • wsl --list --online to see list of available distros
  • wsl --list -v to see state of installed distros
  • df inside WSL to see drives, eg the Windows c: drive
  • can run Windows commands inside WSL
    • eg notepad.exe (but remember to edit files in Linux format)
    • eg explorer.exe to use Windows to explorer WSL
    • code . is an exception
      • special handling to run VSCode
      • runs as a client/server app
      • extensions can be local (Windows) or on server (WSL)
      • localhost on WSL is port forwarded to Windows
  • can install GUI apps in WSL and run them from Windows
    • eg Gimp - install in WSL and it’ll show up on Windows menu under Ubuntu
    • useful if there’s an app you want to run that’s only available on Linux
  • .Net Core is just another app available from apt or whatever
This post is licensed under CC BY 4.0 by the author.