最新要闻

广告

手机

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

家电

天天快讯:把WSL安装到指定目录下的简易完美方法

来源:博客园

旧版 WSL 的手动安装步骤 (Microsoft Learn)

用Microsoft Store安装比自己下载AppxBundle快很多、下载的文件小(差不多是60MB vs 120MB),后者还可能断线(还不能续传)。

下面以Debian为例:


(资料图)

  1. 导出安装为tar文件:wsl --export debian e:\debian.tar
  2. 删除旧安装:wsl --unregister debian
  3. 导入新安装到指定目录:wsl --import debian d:\debian e:\debian.tar
  4. 然后可以再wsl --export一次,到别的机器上装时就方便了。

之后开始菜单里的快捷方式依然可用,只是默认用root登录,可编辑.profile,在最后加3行:

cd /home/user # 你的用户名su -l user # switch_user -login 你的用户名exit

解决vim打开文件时默认进入REPLACE模式的办法:在~/.vimrc中加入2行 [stackoverflow]:

syntax onset noek

在vim里:help noek "esckeys" "ek" boolean (Vim default: on, Vi default: off) global

  • Function keys that start with an are recognized in Insert mode. When this option is off, the cursor and function keys cannot be used in Insert mode if they start with an . The advantage of this is that the single is recognized immediately, instead of after one second. Instead of resetting this option, you might want to try changing the values for "timeoutlen" and "ttimeoutlen". Note that when "esckeys" is off, you can still map anything, but the cursor keys won"t work by default.
  • NOTE: This option is set to the Vi default value when "compatible" is set and to the Vim default value when "compatible" is reset.
  • NOTE: when this option is off then the |modifyOtherKeys| functionality is disabled while in Insert mode to avoid ending Insert mode with any key that has a modifier.

编辑器还可以用nano. 当然,WSL嘛,MadEdit, vscode, UltraEdit...

debian.tar 260MB, d:\debian占用255MB.然后再开始在debian下装软件。

Debian 11 (bullseye) 国内软件源[吃饱了撑的用https, http能用的;把我的皮肤钱捞回来:-)]

deb http://mirrors.163.com/debian/ bullseye main non-free contribdeb-src http://mirrors.163.com/debian/ bullseye main non-free contribdeb http://mirrors.163.com/debian-security/ bullseye-security maindeb-src http://mirrors.163.com/debian-security/ bullseye-security maindeb http://mirrors.163.com/debian/ bullseye-updates main non-free contribdeb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contribdeb http://mirrors.163.com/debian/ bullseye-backports main non-free contribdeb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib

鼠标右键粘贴。apt-get clean;apt-get update;apt-get install vim build-essential gcc

  • Need to get 95.2 MB of archives.
  • After this operation, 350 MB of additional disk space will be used.

WIN10系统右击开始菜单没有属性选项怎么办[不好使。暂时满足于点Debian能打开,具体啥命令不知道]

  • wsl--exec, -e <命令行> 执行指定的命令而不使用默认的 Linux shell [Debian应该是Windows\System32\wsl.exe的快捷方式]
  • wsl --user, -u <用户名> 以指定用户身份运行。[改不了快捷方式可以改.profile]

apt-get install g++ lex bison

  • Need to get 1,991 kB of archives.
  • After this operation, 4,948 kB of additional disk space will be used.

gcc version 10.2.1 20210110 (Debian 10.2.1-6) d:\debian占用835MB.

说微软啥好呢?费劲的做了,加个压缩生成.tar.gz, .xz, .bzip2……不做?压缩的专利该过期了吧?

wsl --help--export <分发版> <文件名>        将分发导出到 tar 文件。对于标准输出,文件名可以是 -。--import <分发版> <安装位置> <文件名> [选项]        将指定的 tar 文件作为新分发进行导入。对于标准输入,文件名可以是 -。C:\Program Files\7-Zip>7z --help7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21Usage: 7z  [...]  [...] [@listfile]  a : Add files to archive  b : Benchmark  d : Delete files from archive  e : Extract files from archive (without using directory names)  h : Calculate hash values for files  i : Show information about supported formats  l : List contents of archive  rn : Rename files in archive  t : Test integrity of archive  u : Update files to archive  x : eXtract files with full paths我是懒得送到stdout再送到7z了。

tar is able to search directories on its own and takes the list of files or directories to be backed up from command line arguments. cpio archives only the files or directories it is told to, but does not search subdirectories recursively on it"s own.

  • OTCC : Obfuscated Tiny C Compiler (bellard.org)616行的C编译器能编译自己,the non-obfuscated versions are finally available: otccn.c and otccelfn.c.
  • TCC : Tiny C Compiler (bellard.org)

关键词: 开始菜单 打开文件 标准输入