WSL2: Difference between revisions

From Wiki
Line 26: Line 26:
         {
         {
             "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
             "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "source": "Windows.Terminal.Wsl",
             "name": "Ubuntu-18.04",
             "name": "Ubuntu-18.04",
    "colorScheme": "Campbell",
             "commandline": "wsl.exe ~ -d Ubuntu-18.04",
             "commandline": "wsl.exe ~ -d Ubuntu-18.04",
            "fontFace": "Consolas",
             "fontSize": 10
             "fontSize": 10,
            "historySize": 9001,
            "padding": "0, 0, 0, 0",
            "snapOnInput": true
         },
         },
         {
         {
             "name": "server1",
             "name": "server1",
             "commandline": "wsl.exe ~ -d Ubuntu-18.04 ssh server1",
             "commandline": "wsl.exe ~ -d Ubuntu-18.04 ssh server1",
            "fontFace": "Consolas",
             "fontSize": 10
             "fontSize": 10
         }
         }

Revision as of 20:13, 11 December 2019

Installation

  1. Activate Windows-Subsystem for Linux
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. Restart
  2. Install Ubuntu from Microsoft Store

Using New Windows Terminal

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


 "profiles":
    [
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "source": "Windows.Terminal.Wsl",
            "name": "Ubuntu-18.04",
            "commandline": "wsl.exe ~ -d Ubuntu-18.04",
            "fontSize": 10
        },
        {
            "name": "server1",
            "commandline": "wsl.exe ~ -d Ubuntu-18.04 ssh server1",
            "fontSize": 10
        }
    ]

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


Nmap

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