WSL2: Difference between revisions

From Wiki
mNo edit summary
mNo edit summary
Line 5: Line 5:
<blockquote>
<blockquote>
<pre>
<pre>
"commandline" : "wsl.exe ~ -d Ubuntu-18.04",
"commandline" : "wsl.exe ~ -d Ubuntu-20.04",
</pre>
</pre>
</blockquote>
</blockquote>
Line 43: Line 43:
fi
fi
</pre>
</pre>
== Multiple Distro Instances ==
<pre>
* Settings -> Apps -> Ubuntu -> Advanced -> Reset to initial state
wsl --list
wsl --export Ubuntu-20.04 Ubuntu_fresh_rootfs.tar.gz
wsl --import DistroName InstallationPath Ubuntu_fresh_rootfs.tar.gz
wsl -d DistroName
</pre>
* alternative: https://github.com/yuk7/wsldl





Revision as of 11:37, 1 December 2021

Using New Windows Terminal

  • profiles.json
    • set defaultProfile to Ubuntu
    • for linux home dir:
"commandline" : "wsl.exe ~ -d Ubuntu-20.04",


Running Linux Commands

  • using bash.exe
bash.exe -c "jupyter-notebook ; /bin/bash"


  • using wsl
wsl jupyter-notebook &

fstab

z: /mnt/z drvfs rw,relatime 0 0

mount network share

mount -t drvfs '\\server\share' /mnt/share

Docker in WSL

  • install docker on linux
  • add to ~/.bashrc
# Start Docker daemon automatically when logging in if not running.
RUNNING=`ps aux | grep dockerd | grep -v grep`
if [ -z "$RUNNING" ]; then
    sudo dockerd > /dev/null 2>&1 &
    disown
fi

Multiple Distro Instances

* Settings -> Apps -> Ubuntu -> Advanced -> Reset to initial state

wsl --list
wsl --export Ubuntu-20.04 Ubuntu_fresh_rootfs.tar.gz

wsl --import DistroName InstallationPath Ubuntu_fresh_rootfs.tar.gz
wsl -d DistroName


Nmap

  • Install Nmap for Windows
  • .bashrc:
alias nmap='"/mnt/c/Program Files (x86)/Nmap/nmap.exe"'