Using Linux through Visual Studio Code
Here’s how you can set the Windows Subsystem for Linux to be the default terminal inside VS Code. This allows for a very simple way to launch a bash prompt:
Ctrl + `
The first thing to do is install the Windows Subsystem for Linux, and then your distro of choice from the Windows Store. There are tons of guides for this, so I’m not going into the details - just search “How to install Windows Subsystem for Linux” and pick a guide that works for you.
Now that you have Linux installed and running, edit VS Code’s preferences. Use the keyboard shortcut:
Ctrl+,
or click on File > Preferences > Setting
Use this line to set the default terminal
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe",
Once this is done, save and restart VS Code. Now just use the Ctrl+` shortcut and VS Code will launch an intergated bash prompt with the current working directory set to the folder you have open.
If you want to change the CWD, use this line
"terminal.integrated.cwd": "C:\\Users\\$USERNAME\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\\LocalState\\rootfs"
I set mine to the root folder in bash. Your username and the package name will be different, of course. You can set the path to anything you like.
This lets me write my blog posts, and then update my site from inside VS Code. Makes things nice and easy. It only takes me one quick command.