User Tools

Site Tools


windows_subsystem_for_linux_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
windows_subsystem_for_linux_setup [2019/08/02 11:47]
tkbletsc created
windows_subsystem_for_linux_setup [2021/07/27 15:04]
tkbletsc [Installing distro]
Line 1: Line 1:
 +====== Windows Subsystem for Linux (WSL) ======
 +
 I'll grudgingly admit that Windows Subsytem for Linux isn't bad like I thought it would be. That said, there are several things you might want to do to make it more livable. I'll grudgingly admit that Windows Subsytem for Linux isn't bad like I thought it would be. That said, there are several things you might want to do to make it more livable.
  
-====== Enabling WSL ======+===== Enabling WSL =====
 First, to enable WSL at all ([[https://docs.microsoft.com/en-us/windows/wsl/install-win10|from here]]), in adminstrator powershell: First, to enable WSL at all ([[https://docs.microsoft.com/en-us/windows/wsl/install-win10|from here]]), in adminstrator powershell:
   Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux   Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 Then, it still being Windows, you have to restart. Then, it still being Windows, you have to restart.
  
-====== Installing distro ====== +===== Installing distro ===== 
-Windows Store is a garbage zone. Here's the spell for skipping that part ([[https://docs.microsoft.com/en-us/windows/wsl/install-manual|from here]]). Just download this URL and double click what you get: https://aka.ms/wsl-ubuntu-1804+Windows Store is a garbage zone. Here's the spell for skipping that part ([[https://docs.microsoft.com/en-us/windows/wsl/install-manual|from here]]). Just download this URL and double click what you get:  
 + 
 +https://aka.ms/wsl-ubuntu-1804 
 + 
 +https://aka.ms/wslubuntu2004 
 Other URLs exist for other distros; you're on your own for that. Other URLs exist for other distros; you're on your own for that.
  
-====== Making it Launchy-launchable ====== +===== Making it Launchy-launchable ===== 
-The distro will be installed as an "app", which is Windows 10 speak for "dumbed down program that's treated in special ways that break normal workflows". If you have classic Start and Launchy, to make it work with Launchy, make a shortcut of the "app", then put the shortcut into the classic start menu programs list.+The distro will be installed as an "app", which is Windows 10 speak for "dumbed down program that's treated in special ways that break normal workflows". If you have classic Start and Launchy, to make it work with Launchy
 +  * Make a shortcut of the "app", then put the shortcut into the classic start menu programs list.
  
-====== Basic packages ====== +===== Update plus basic packages ===== 
-The default package set is actually not bad. But here'what's missing:+The default package set is actually not bad. But this will update and install what's missing: 
 +  sudo apt update 
 +  sudo apt dist-upgrade
   sudo apt install lynx links binutils zip unzip gdb   sudo apt install lynx links binutils zip unzip gdb
  
 +===== Symlinks =====
 +To get to places easily:
 +  ln -s /mnt/c/Users/$USER ~
 +  sudo ln -s /mnt/c /c
 +
 +===== "Open Linux Shell Here" context menu =====
 +It turns out there already is one by default, but it only shows if you //shift// right click. To make it always visible ([[https://winaero.com/blog/make-open-linux-shell-always-visible/|per here]]):
 +  * Download and run "[[https://winaero.com/blog/execti-run-programs-trustedinstaller/|ExecTI]]" to allow you to run regedit as TrustedInstaller (more privileges than admin)
 +  * Run regedit using the tool
 +  * In ''HKEY_CLASSES_ROOT\Directory\shell\WSL'', delete the key ''Extended''
 +
 +===== Run explorer from this directory in bash =====
 +I'm used to saying ''start .'' to open an explorer in this directory. Using [[https://stackoverflow.com/questions/44245721/launching-explorer-from-wsl|this recipe]], you can add the following to ~/.bashrc to restore this functionality:
 +  alias start="powershell.exe /c start"
 +
 +
 +===== Keyboard scrolling =====
 +By default, there's no keyboard shortcut to scroll the Windows terminal. Per [[https://superuser.com/questions/1408859/windows-subsystem-linux-terminal-scrolling-using-keyboard|here]], a quick duct tape solution is to use the following script in [[https://www.autohotkey.com/|AutoHotKey]]:
 +<code>
 +#IfWinActive ahk_class ConsoleWindowClass
 +
 ++PgUp::
 +Send {WheelUp}
 +Return
 +
 ++PgDn::
 +Send {WheelDown}
 +Return
 +
 +#IfWinActive
 +</code>
 +
 +===== Script to mount *all* drives =====
 +By default, WSL just mounts physical drives around at boot. This script mounts all drives Windows knows about to directories under /mnt:
  
 +<code>
 +for DRV in `wmic.exe logicaldisk get name | grep : | awk '{print tolower($1)}'` ; do
 +    MNT=/mnt/${DRV::1}
 +    if mount | grep -q $MNT ; then
 +        echo $MNT already mounted
 +    else
 +        sudo mkdir -p $MNT
 +        sudo mount -t drvfs $DRV $MNT
 +    fi
 +done
 +</code>
  
windows_subsystem_for_linux_setup.txt · Last modified: 2021/07/28 20:00 by tkbletsc