List all the available distributions online.
wsl -l -oInstall WSL2 and Ubuntu.
wsl --install -d UbuntuThen restart the machine.
If failed, uninstall Ubuntu and reinstall.
wslconfig /u UbuntuList the installed distributions.
wsl -l -vUpdate WSL2.
wsl --updateUpgrade Ubuntu.
sudo do-release-upgradeUninstall Ubuntu.
wsl --unregister UbuntuThen Remove the Canonical* folder in %LocalAppData%\Packages.
Uninstall WSL2.
wsl --uninstallFailed to retrieve available kernel versions
sudo apt purge needrestart
sudo apt autoremove (optional)Docker Desktop failed to stop
wsl --unregister docker-desktopssh-keygen -t ed25519 -C "[email protected]"Add SSH key to the ssh-agent.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Add SSH key to GitHub.
cat ~/.ssh/id_ed25519.pubTest SSH connection.
ssh -T [email protected]Clone the repo.
git clone [email protected]:xian-wen/dotfiles.git ~/.dotfiles/Create a symbolic link to enable SSH to Github over HTTPS.
ln -sf /home/xianwen/.dotfiles/.ssh/config ~/.ssh/Create a symbolic link to add metadata to Windows files to support Linux system permissions.
sudo ln -sf /home/xianwen/.dotfiles/wsl.conf /etc/ssh: connect to host github.com port 22: No route to host
ssh -T -p 443 [email protected]
git clone ssh://[email protected]:443/xian-wen/dotfiles.git ~/.dotfiles/sudo apt install build-essential procps curl file git/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Create a symbolic link to add Homebrew to PATH.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Update Homebrew.
brew updateRemove the setup of Homebrew in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -rf /home/linuxbrew/error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
Force git using http version 1.1.
git config --global http.version HTTP/1.1Then install Homebrew as normal. After that, reset the http version.
git config --global --unset http.versionOr increase the http post buffer size.
git config --global http.postBuffer 4096MThen install Homebrew as normal. After that, reset the buffer to default size.
git config --global http.postBuffer 1Msudo apt install fishbrew install fishwhich fish | sudo tee -a /etc/shellsChange the default shell to fish.
chsh -s $(which fish)Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/Upgrade fish.
sudo apt upgrade fishIf installed with Homebrew, run
brew upgrade fishChange the default shell to Bash.
chsh -s $(which bash)Uninstall fish.
sudo apt remove --purge fish
sudo apt autoremoveIf installed with Homebrew, run
brew uninstall fish
sudo rm -rf /home/linuxbrew/.linuxbrew/etc/fish/sudo apt install zshChange the default shell to ZSH.
chsh -s $(which zsh)If needs to input password, manually modify /etc/passwd .
root:x:0:0:root:/root:bash
xianwen:x:1000:1000:,,,:/home/xianwen:/usr/bin/zsh
sudo apt install fonts-powerlinesh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"If failed, install from the mirror.
sh -c "$(curl -fsSL https://install.ohmyz.sh/)"git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10kConfigure Powerlevel10k.
p10k configuregit clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionsInstall zsh-syntax-highlighting.
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingCreate a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.zshrc ~/omz updateuninstall_oh_my_zshChange the default shell to Bash.
chsh -s $(which bash)Uninstall ZSH, including configurations and dependencies.
sudo apt remove --purge zsh
sudo apt autoremovesudo: nvim: command not found
- To modify a root file, either edit with
sudo -e.
sudo -e /etc/hosts- Or edit with
sudoedit.
sudoedit /etc/hosts- Or edit with
sudo -E -s, which preserves the environment variables.
sudo -E -s
nvim /etc/hostscurl: Failed to connect to raw.githubusercontent.com port 443: Connection refused
Add below to the /etc/hosts file.
185.199.108.133 raw.githubusercontent.com
brew install nushellUpgrade Nushell.
brew upgrade nushellUninstall Nushell.
brew uninstall nushellbrew install starshipcurl -sS https://starship.rs/install.sh | shCreate a symbolic link to use Starship.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.config/starship.toml ~/.config/Upgrade Starship.
brew upgrade starshipIf installed with curl, rerun
curl -sS https://starship.rs/install.sh | shRemove the initialization of Starship in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall Starship.
brew uninstall starshipIf installed with curl, locate and delete the Starship binary.
sh -c 'rm "$(command -v 'starship')"'Install below, bat, and fd. (Ref: heading ids and links in markdown)
brew install ripgrep xclipbrew install neovimOr install with apt, but the version is too old.
sudo apt install neovimsudo apt install ninja-build gettext cmake unzip curl build-essentialClone the repo.
git clone https://github.com/neovim/neovim.gitcd neovim/
git checkout stable
make distclean # If build neovim before.
make CMAKE_BUILD_TYPE=Release
sudo make installCreate a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.config/nvim/ ~/.config/Create a symbolic link to set EDITOR to nvim.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Open Neovim and plugins will be automatically installed by lazy.nvim.
nvimCreate a symbolic link to enable X11 forwarding over SSH, so that clipboard can be used on remote machines.
ln -sf /home/xianwen/.dotfiles/.ssh/config ~/.ssh/Upgrade Neovim.
brew upgrade neovimIf installed with apt, run
sudo apt upgrade neovimPull the repo.
cd neovim/
git pullBuild again.
Uninstall Neovim.
brew uninstall neovimIf installed with apt, run
sudo apt remove --purge neovim
sudo apt autoremovesudo cmake --build build/ --target uninstall
sudo rm /usr/local/bin/nvim
sudo rm -r /usr/local/share/nvim/
rm -rf ~/.config/nvim/
rm -rf ~/.local/share/nvim/
rm -rf ~/.local/state/nvim/
rm -rf ~/.cache/nvim/No xauth data; using fake authentication data for X11 forwarding
Create an empty ~/.Xauthority file in the local machine, and add the magic cookie.
touch ~/.Xauthority
xauth add :0 . `mcookie`Check the magic cookie has been associated with the correct hostname of the new PC.
xauth listcurl: (56) Recv failure: Connection reset by peer
checkhealth codeium: WARNING No heartbeat executed
export no_proxy=127.0.0.1git clone https://github.com/LazyVim/starter ~/.config/lazyvim/Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.config/lazyvim/ ~/.config/Create a symbolic link to maintain multiple configurations, so that LazyVim can be opened with lazyvim instead of NVIM_APPNAME="lazyvim" nvim.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Open LazyVim and plugins will be automatically installed by lazy.nvim.
lazyvimUpdate LazyVim.
:Lazy syncUninstall LazyVim.
rm -rf ~/.config/lazyvim/
rm -rf ~/.local/share/lazyvim/
rm -rf ~/.local/state/lazyvim/
rm -rf ~/.cache/lazyvim/git clone https://github.com/NvChad/starter ~/.config/nvchad/Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.config/nvchad/ ~/.config/Create a symbolic link to maintain multiple configurations, so that NvChad can be opened with nvchad instead of NVIM_APPNAME="nvchad" nvim.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Open NvChad and plugins will be automatically installed by lazy.nvim.
nvchadInstall LSP, linter and formatter.
:MasonInstallAll:Lazy syncrm -rf ~/.config/nvchad/
rm -rf ~/.local/share/nvchad/
rm -rf ~/.local/state/nvchad/
rm -rf ~/.cache/nvchad/Install below, bat, and fzf. (Ref: heading ids and links in markdown)
brew install ripgrep xclip universal-ctags globalChange the default editor to Vim.
sudo update-alternatives --config editorIf the built-in version is too old, install with Homebrew.
brew install vimsudo apt install git make clang libtool-bin libpython3-devClone the repo.
git clone https://github.com/vim/vim.gitAdd Python 3 support, uncomment CONF_OPT_PYTHON3 = --enable-python3interp in Makefile, and run
make reconfigcd vim/src/
make distclean # If you build vim before.
make
make test # Optional, may take a long time.
sudo make installCreate a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.vimrc ~/Open Vim and plugins will be automatically installed by vim-plug.
vimUpgrade Vim.
sudo apt upgrade vimIf installed with Homebrew, run
brew upgrade vimPull the repo.
cd vim
git pullIf Makefile locally changed.
cd vim
git stash
git pull
git stash popBuild again.
Uninstall Vim.
sudo apt remove --purge vim
sudo apt autoremoveIf installed with Homebrew, run
brew uninstall vimmake uninstall_runtimeYouCompleteMe error: ycmd server SHUT DOWN
Install prerequisites and reinstall YouCompleteMe.
sudo apt install build-essential cmake vim-nox python3-dev
cd ~/.vim/plugged/YouCompleteMe/
./install.py --clangd-completer --java-completer --go-completer --rust-completerYouCompleteMe unavailable: requires Vim 9.1.0016+
Install a newer version Vim.
YouCompleteMe unavailable: requires Vim compiled with Python (3.8.0+) support
Build Vim with python 3 support.
The built-in Byobu in Ubuntu may be a better replacement for Tmux.
sudo apt install tmuxgit clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpmCreate a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.tmux.conf ~/Upgrade Tmux.
sudo apt upgrade tmuxUninstall Tmux Plugin Manager.
rm -rf ~/.tmux/Uninstall Tmux.
sudo apt remove --purge tmux
sudo apt autoremovebrew install batOr install with apt, but need to create a symbolic link to replace batcat with bat, and the version is too old.
sudo apt install bat
sudo ln -s $(which batcat) ~/usr/local/bin/batOr download the latest .deb package. (Ref: download github release)
curl -OL https://github.com/sharkdp/bat/releases/download/v0.24.0/bat_0.24.0_amd64.deb
sudo dpkg -i bat_0.24.0_amd64.debbrew install bat-extrasCreate a symbolic link to replace batman with man.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Upgrade bat.
brew upgrade batIf installed with apt, run
sudo apt upgrade batUpgrade bat-extras.
brew upgrade bat-extrasRemove the setup of bat-extras in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall bat-extras.
brew uninstall bat-extrasUninstall bat.
brew uninstall batIf installed with apt, run
sudo apt remove --purge bat
sudo apt autoremoveInstall fd.
brew install fdOr install with apt, but need to create a symbolic link to replace fdfind with fd, and the version is too old.
sudo apt install fd-find
sudo ln -s $(which fdfind) /usr/local/bin/fdUpgrade fd.
brew upgrade fdIf installed with apt, run
sudo apt upgrade fdUninstall fd.
brew uninstall fdIf installed with apt, run
sudo apt remove --purge fd
sudo apt autoremovebrew install bat ripgrep the_silver_searcher perl universal-ctagsbrew install fzfOr install with apt, but the version is too old.
sudo apt install fzfCreate a symbolic link to set up shell integration.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Upgrade fzf.
brew upgrade fzfIf installed with apt, run
sudo apt upgrade fzfRemove the setup of fzf in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall fzf.
brew uninstall fzfIf installed with apt, run
sudo apt remove --purge fzf
sudo apt autoremovebrew install lazygitUpgrade Lazygit.
brew upgrade lazygitUninstall Lazygit.
brew uninstall lazygitsudo apt install bearsudo apt upgrade bearUninstall bear.
sudo apt remove --purge bear
sudo apt autoremoveIn included file: 'bits/libc-header-start.h' file not found
sudo apt install gcc-multilibgit clone https://github.com/pwndbg/pwndbg
cd pwndbg
./setup.shRemove the source line in the .gdbinit file, then remove the pwndbg folder to uninstall.
rm -rf ~/downloads/pwndbg/sudo apt instal rustupThen install cargo, and rustc.
rustup default stablecurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThen create a symbolic link to configure the PATH environment variable.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Upgrade rustup.
sudo apt upgrade rustupIf installed with curl, run
rustup updateUninstall rustup.
sudo apt remove --purge rustup
sudo apt autoremoveIf installed with curl, run
rustup self uninstallerror: failed to run custom build command for openssl-sys v0.9.105
sudo apt install pkg-config libssl-devbrew install pipxOr install with apt, but the version is too old.
sudo apt install pipxCreate a symbolic link to do shell setup, and enable completions.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/brew upgrade pipxIf installed with apt, run
sudo apt upgrade pipxRemove the setup of pipx in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall pipx.
brew uninstall pipxIf installed with apt, run
sudo apt remove --purge pipx
sudo apt autoremoveCommand 'register-python-argcomplete' not found
Install argcomplete, run pipx completions for more details.
pipx install argcompletepip install pqipip install --upgrade pqiUninstall pip registry manager.
pip uninstall pqibrew install fnmcurl -fsSL https://fnm.vercel.app/install | bashCreate a symbolic link to do shell setup (if installed with Homebrew), and enable completions.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.config/fish/ ~/.config/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Install Node.js (latest LTS version).
fnm install --ltsbrew upgrade fnmIf installed with curl, run
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shellUpgrade Node.js, rerun
fnm install --ltsfnm uninstall $(fnm current)Remove the setup of Fast Node Manager in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall Fast Node Manager.
brew uninstall fnmIf installed with curl, remove the Fast Node Manager folder.
rm -rf ~/.local/share/fnm/Install Node Version Manager, which does not support fish and Homebrew.
PROFILE=/dev/null bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash'Create a symbolic link to have it automatically sourced upon login.
ln -sf /home/xianwen/.dotfiles/.bashrc ~/
ln -sf /home/xianwen/.dotfiles/.zshrc ~/Install Node.js (latest LTS version).
nvm install --ltsPROFILE=/dev/null bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash'nvm install --reinstall-packages-from=current 'lts/*'Uninstall Node.js (latest LTS version).
nvm uninstall --ltsRemove the setup of Node Version Manager in shell config (e.g., ~/.bashrc, ~/.config/fish/config.fish, ~/.zshrc, etc.) before uninstall.
Uninstall Node Version Manager.
nvm_dir="${NVM_DIR:-~/.nvm}"
nvm unload
rm -rf "$nvm_dir"curl: (6) Could not resolve host: raw.githubusercontent.com
If ping 8.8.8.8 worked, while ping google.com failed, run
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.confInstall npm registry manager.
npm install -g nrmUpdate npm registry manager.
npm update -g nrmUninstall npm registry manager.
npm uninstall -g nrmInstall Yarn registry manager.
npm install -g yrmUpdate Yarn registry manager.
npm update -g yrmUninstall Yarn registry manager.
npm uninstall -g yrmSearch for the latest version of PowerShell.
winget search Microsoft.PowerShellInstall PowerShell.
winget install --id Microsoft.Powershell --source wingetCheck available PowerShell upgrade.
winget list --name PowerShell --upgrade-availableUpgrade PowerShell.
winget upgrade --id Microsoft.Powershell --source wingetUninstall PowerShell.
winget uninstall --id Microsoft.Powershell --source wingetwinget install starshipCopy windows/powershell/Microsoft.PowerShell_profile.ps1 into the directory of $PROFILE to use Starship.
cp ~/.dotfiles/windows/powershell/Microsoft.PowerShell_profile.ps1 /mnt/c/Users/Xianwen/Documents/PowerShellUpgrade Starship.
winget upgrade starshipRemove the initialization of Starship in $PROFILE before uninstall.
Uninstall Starship.
winget uninstall starshipwinget install JanDeDobbeleer.OhMyPosh -s wingetoh-my-posh font installOr manually install Nerd Fonts in Settings > Personalization > Fonts.
Copy windows/powershell/Microsoft.PowerShell_profile.ps1 into the directory of $PROFILE to use Oh My Posh and set the theme.
cp ~/.dotfiles/windows/powershell/Microsoft.PowerShell_profile.ps1 /mnt/c/Users/Xianwen/Documents/PowerShellGet-PoshThemesoh-my-posh upgradewinget upgrade JanDeDobbeleer.OhMyPosh -s wingetTo enable automated upgrade, run
oh-my-posh enable upgradeRemove the setup of Oh My Posh in $PROFILE before uninstall.
Uninstall Oh My Posh.
winget uninstall JanDeDobbeleer.OhMyPosh -s wingetInstall-Module posh-git -Scope CurrentUser -ForceCopy windows/powershell/Microsoft.PowerShell_profile.ps1 into the directory of $PROFILE to import the module.
cp ~/.dotfiles/windows/powershell/Microsoft.PowerShell_profile.ps1 /mnt/c/Users/Xianwen/Documents/PowerShellUpdate posh-git.
Update-Module posh-gitRemove the setup of post-git in $PROFILE before uninstall.
Uninstall posh-git.
Uninstall-Module post-gitInstall-Module PSReadLine -Scope CurrentUser -ForceCopy windows/powershell/Microsoft.PowerShell_profile.ps1 into the directory of $PROFILE to import the module and update configuration.
cp ~/.dotfiles/windows/powershell/Microsoft.PowerShell_profile.ps1 /mnt/c/Users/Xianwen/Documents/PowerShellUpdate-Module PSReadLineRemove the setup of PSReadLine in $PROFILE before uninstall.
Uninstall PSReadLine.
Uninstall-Module PSReadLinewinget install nushellUpgrade Nushell.
winget upgrade nushellUninstall Nushell.
winget uninstall nushellwinget install fzfUpgrade fzf.
winget upgrade fzfUninstall fzf.
winget uninstall fzfwinget install lazygitUpgrade Lazygit.
winget upgrade lazygitUninstall Lazygit.
winget uninstall lazygit