Coder's Cat

Random WSL Tips & Tricks

2021-06-02

Quick launch of Linux terminal

img:wsl-luach

Quick access to the home directory of Linux

Paste this file address to explorer. Here the ubuntu is your Linux distribution’s Name:

\\wsl$\ubuntu

Quick access current directory with explore.exe:

explorer.exe .

Copy the content of a file in WSL to Windows System

cat report.txt | clip.exe

Open VSCode

Launch VSCode and open current directory as a open project.

code .

Launch VSCode and open file with name of demo.js.

code demo.js 

Shutdown or restart a distribution

Sometimes, Linux will hang on for some weird reasons. We can try to shutdown it to make it normal.

wslconfig /L        # to list all distributions 
wslconfig /t Ubuntu # shutdown your wsl distribution

Restart the whole WSL Service

Open powershell with Admin privileges and type the below command to restart the lxxsManger:

Get-Service LxssManager | Restart-Service