Thursday, January 21, 2021

Windows WSL 2 和 Debian

WSL - Windows Subsystem for Linux 安装教程看这里,现在不需要加入 Windows Insiders Program 就可以安装。

装了 WSL 2,并从 Microsoft store 安装了 Debian。

查看

$ less /etc/apt/sources.list

deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian buster-updates main
deb http://security.debian.org/debian-security/ buster/updates main
deb http://ftp.debian.org/debian buster-backports main

做更新

$ sudo apt-get update
$ sudo apt-get dist-upgrade

查看核心

$ uname -r
4.19.128-microsoft-standard

安装 VIM

$ sudo apt-get install vim

在 Windows 上装一个 LINUX 子系统还是有点用处的。

可以看出这个核心是 4.19.128,有点老。想升级一下 kernel 到最新版,怎么办?很多人在网上问。按照下面的步骤就可以了:

  • 到 Windows Settings
  • 到 Update & Security
  • 到 Windows Update
  • 到 Advanced Options
  • 打开 Receive updates for other Microsoft products when you update Windows

经过更新后,再查看:

$ uname -r
5.4.72-microsoft-standard-WSL2

+++++

Windows 10 自身没有什么批量修改文件名的功能,除非你会 Powershell script。装了 WSL 和 Debian,可以在 File Explorer 里打开它的目录:

\\wsl$\Debian

你可以把 Windows 10 上的文件挪到 \home 下你的用户名目录下,利用上面的 script 进行各种批量改名。

你也可以从 WSL 访问 Windows 10 的 C 驱或者 D 驱等。

ls /mnt
cd /mnt/c

再来运行 shell script。

但是对你局域网内的网盘就无法这么操作了。

+++++

即使没有 WSL,也可以安装 Cygwin运行 bash 的 shell script,且对网盘也可以这么操作

 

No comments:

Post a Comment