[Linux] Build a Linux environment under window to develop C language (WSL + VScode + zsh basic configuration and beautification)-window subsystem Ubuntu terminal

(1) Install WSL

  • Open the subsystem support
    1.win + x, select Windows PowerShell (administrator)
    2. Enter:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    3. Enter, enter Y, restart.

  • Download and run the subsystem
    1. Open the application store, search for "Linux", install your favorite version, the author uses Ubuntu
    (no Microsoft account, follow the prompts to register and log in)
    2. Run after the installation is complete, the installation prompts to customize the user name and password.
    Insert picture description here

(2) VScode configuration

  • Set the default to use the WSL terminal
    Insert picture description here
    Insert picture description here
    Insert picture description here
    . Add this sentence in the VSCode settings file
"terminal.integrated.shell.windows": "C:\\\\Windows\\\\System32\\\\wsl.exe",
  • Installed plugins
    Insert picture description here

(3) Terminal configuration and beautification

1. The name is Ubuntu, the name is whatever you want

2. Inside the big box below set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl --distro-guid={54d1c74b-1774-457f-b68f-82aae05350c3} -cur_console:pm:/mnt. This 54d1c74b-1774-457f-b68f-82aae05350c3refers to the unique identifier of Ubuntu. If the subsystem is reinstalled, this identifier will change accordingly. You can find it in the registry (regedit) 计算机\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss. win+R搜索regedit.

Insert picture description here
The basic configuration has been completed here. Friends who want to use powerful zsh can continue to configure and beautify the terminal.

  • Install oh-my-zsh

Use command line in Ubuntu system instead of win

Be sure to update before installing any packages! sudo apt-get update

Install zsh sudo apt-get install zsh

Install oh-my-zsh sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Successful installation

  • Beautify and optimize

1. Change theme

If you are using it vim ~/.bashrc, use :wqexit after editing .

If you are using it nano ~/.bashrc, Ctrl+Shift+Xsave and exit.

Modify the theme:

vim ~/.zshrc
# 主题名字ys,你可以搜索其他的主题使用
ZSH_THEME="ys"

Save after modification.

2. To explain the requirements of oh-my-zsh third-party plug-ins.

(4) Directory management

  • window to access the Linux directory
    win + R, enter\\wsl$
    Insert picture description hereInsert picture description here
  • Enter the window directory under the Linux terminal
    For example: enter the C drivecd /mnt/c
  • It is more convenient if the right button of cmder is configured

Insert picture description here

  • Configure the right-click menu: Administrator runs cmd (note that it is cmdnot Cmder), enter the path where Cmder.exe is located, and run the command:
    Cmder.exe /REGISTER ALL

(5) Small trial cattle knife

Insert picture description here
Insert picture description here

(6) Reference materials

https://docs.microsoft.com/en-us/windows/wsl/install-win10
https://www.jianshu.com/p/f4d046fea5db
https://blog.joaograssi.com/windows-subsystem-for-linux-with-oh-my-zsh-conemu/

Published 22 original articles · praised 17 · visits 1981

Guess you like

Origin blog.csdn.net/JeeCai/article/details/105693088