Practical tips on using the Linux subsystem on Windows

  1. Type bash at a PowerShell or command prompt to run bash.
  2. Use bash inside ConEmu (see above).
  3. From within bash,
    • the C drive is at /mnt/c/.
    • pwd outputs your current location.
    • lsb_release -r outputs your Ubuntu version.
    • SOME_VAR="SOME_VALUE" sets a local environmental variable.
    • export SOME_VAR="SOME_VALUE" sets a global environmental variable.
    • printenv SOME_VAR outputs the environmental variable
    • separate multiple command with ampersands: command1 && command2 && et cetera
    • single quotes behave differently than do double quotes
  4. Use PowerShell in the Linux subsystem for Windows.
    1. install PowerShell
    2. open a bash prompt
    3. type powershell
    4. type exit to return to bash
  5. Install Node/NPM from bash.
  6. Paste from the Window's clipboard into bash using right click.
  7. Clear the current input using Ctrl + E + U.
  8. Convert from dos to unix line endings in vim with this command :set ff=unix.
  9. Pipe command output to file and show it in the sell command |& tee output.txt.