Add WSL introductions (Chinese and English)

This commit is contained in:
cclvi256 2024-04-24 04:13:18 +08:00
parent a9b0308e29
commit 5fe77350dc
No known key found for this signature in database
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,42 @@
# WSL - Windows Subsystem for Linux
## For MacOS Users
If you're using MacOS, it's none of necessity to learn WSL, so you can skip this page now.
## Why Linux?
Nowadays we have to admit Windows is necessary to our daily study and entertainment, but when it comes to development, Linux is more friendly.
For instance, when you want to install GCC on Windows, and then configure Visual Studio Code as your editor, you should download MinGW and configure the path environment variable, then even a reboot. It seems to take more than 5 minutes for new learners.
But when in Linux, install GCC only need one line of command:
```shell
# The command varies by distros.
# If you're the root, "sudo" is redundant.
sudo apt install gcc
sudo dnf install gcc
sudo yum install gcc
sudo pacman -S gcc
```
By the way, learning to use Linux, is also necessary for CS students. So why not try to learn Linux as early as possible?
## Why WSL?
In fact, if you wish so, you can install a Linux distro as your main system and install Windows in a VM, reversing the common approach.
But it's better for most of the new learners to learn Linux with VM in Windows, and WSL, as an alternative for VMs, is easier to install, use, and connect.
## Installing WSL and basic configuration
For WSL installing, you can refer to the [official tutorial](https://learn.microsoft.com/en-us/windows/wsl/install).
Commonly, it's necessary to change the software source to your country or region, and configure the international network access. This operation varies by your distro and your approach of international network access.
## Connecting to your WSL
When using powershell, use the command `wsl` will open the WSL shell, like SSH to some extends. You can type and run commands here. You can also add a profile for WSL.
But when you want to develop in the WSL environment, many IDEs and editors, for example, JetBrains IDEs, Visual Studio Code, etc., provide WSL remote development. You can create, delete, modify files, and even debug as usual.

42
docs/必学工具/wsl.md Normal file
View file

@ -0,0 +1,42 @@
# WSL - Windows Subsystem for Linux
## 对于 MacOS 用户
MacOS 本身是一种类 Unix 系统,所以没必要学 WSL本页可以跳过。
## 为什么选择 Linux
Windows 对我们的日常学习和娱乐非常重要,但 Linux 对于开发者的开发活动来说更加友好。
例如,如果你想在 Windows 上安装 GCC然后配置 Visual Studio Code 作为你的编辑器,你需要下载 MinGW然后配置环境变量 PATH还可能需要重启。对于初学者来说这似乎需要超过 5 分钟的时间。
但在 Linux 中,安装 GCC 只需要一条命令:
```shell
# 命令因发行版而异。
# 如果你是root用户去掉“sudo”。
sudo apt install gcc
sudo dnf install gcc
sudo yum install gcc
sudo pacman -S gcc
```
另外,学习使用 Linux 也是 CS 学生的必修课。尽早尝试学习 Linux 也是大有裨益的。
## 为什么选择 WSL
如果你愿意,你可以反其道而行之,安装一个 Linux 发行版作为你的主要系统,并在虚拟机中安装 Windows。
但对于大多数新学习者来说,在 Windows 中使用虚拟机学习 Linux 更合适WSL 也可以称为一种虚拟机,但更容易安装、使用和连接。
## 安装 WSL 和基本配置
对于 WSL 的安装,你可以参考[官方教程](https://learn.microsoft.com/zh-cn/windows/wsl/install)。
记得换源和配置魔法。对于不同的发行版或魔法,操作可能有所区别。
## 连接到你的 WSL
当使用 PowerShell 时,使用命令`wsl`,即可打开 WSL 的 shell 界面,类似于 SSH。你可以在这里输入和运行命令。你也可以为 WSL 添加一个 Powershell 配置文件。
许多 IDE 和编辑器例如JetBrains IDEs、Visual Studio Code 等,都提供了 WSL 远程开发功能。你可以像操作本机 C:\文件一样创建、删除、修改文件,甚至还可以进行调试。