List all the available distributions online.
wsl -l -o
Install WSL2 and Ubuntu.
wsl --install -d Ubuntu
Then restart the machine.
If failed, uninstall Ubuntu and reinstall.
wslconfig /u Ubuntu
List the installed distributions.
wsl -l -v
Update WSL2.
wsl --update
Upgrade Ubuntu.
sudo do-release-upgrade
Uninstall Ubuntu.
wsl --unregister Ubuntu
Then Remove the Canonical*
folder in %LocalAppData%\Packages
.
Uninstall WSL2.
wsl --uninstall
Failed to retrieve available kernel versions
sudo apt purge needrestart
sudo apt autoremove (optional)
Docker Desktop failed to stop
wsl --unregister docker-desktop
ssh-keygen -t ed25519 -C "[email protected]"
Add SSH key to the ssh-agent.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Add SSH key to GitHub.
cat ~/.ssh/id_ed25519.pub
Test 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 update
Remove 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.1
Then install Homebrew as normal. After that, reset the http version.
git config --global --unset http.version
Or increase the http post buffer size.
git config --global http.postBuffer 4096M
Then install Homebrew as normal. After that, reset the buffer to default size.
git config --global http.postBuffer 1M
sudo apt install fish
brew install fish
which fish | sudo tee -a /etc/shells
Change 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 fish
If installed with Homebrew, run
brew upgrade fish
Change the default shell to Bash.
chsh -s $(which bash)
Uninstall fish.
sudo apt remove --purge fish
sudo apt autoremove
If installed with Homebrew, run
brew uninstall fish
sudo rm -rf /home/linuxbrew/.linuxbrew/etc/fish/
sudo apt install zsh
Change 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-powerline
sh -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/powerlevel10k
Configure Powerlevel10k.
p10k configure
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Install 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-highlighting
Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.zshrc ~/
omz update
uninstall_oh_my_zsh
Change the default shell to Bash.
chsh -s $(which bash)
Uninstall ZSH, including configurations and dependencies.
sudo apt remove --purge zsh
sudo apt autoremove
sudo: 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/hosts
curl: 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 nushell
Upgrade Nushell.
brew upgrade nushell
Uninstall Nushell.
brew uninstall nushell
brew install starship
curl -sS https://starship.rs/install.sh | sh
Create 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 starship
If installed with curl, rerun
curl -sS https://starship.rs/install.sh | sh
Remove the initialization of Starship in shell config (e.g., ~/.bashrc
, ~/.config/fish/config.fish
, ~/.zshrc
, etc.) before uninstall.
Uninstall Starship.
brew uninstall starship
If 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 xclip
brew install neovim
Or install with apt, but the version is too old.
sudo apt install neovim
sudo apt install ninja-build gettext cmake unzip curl build-essential
Clone the repo.
git clone https://github.com/neovim/neovim.git
cd neovim/
git checkout stable
make distclean # If build neovim before.
make CMAKE_BUILD_TYPE=Release
sudo make install
Create 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.
nvim
Create 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 neovim
If installed with apt, run
sudo apt upgrade neovim
Pull the repo.
cd neovim/
git pull
Build again.
Uninstall Neovim.
brew uninstall neovim
If installed with apt, run
sudo apt remove --purge neovim
sudo apt autoremove
sudo 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 list
curl: (56) Recv failure: Connection reset by peer
checkhealth codeium
: WARNING No heartbeat executed
export no_proxy=127.0.0.1
git 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.
lazyvim
Update LazyVim.
:Lazy sync
Uninstall 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.
nvchad
Install LSP, linter and formatter.
:MasonInstallAll
:Lazy sync
rm -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 global
Change the default editor to Vim.
sudo update-alternatives --config editor
If the built-in version is too old, install with Homebrew.
brew install vim
sudo apt install git make clang libtool-bin libpython3-dev
Clone the repo.
git clone https://github.com/vim/vim.git
Add Python 3 support, uncomment CONF_OPT_PYTHON3 = --enable-python3interp
in Makefile
, and run
make reconfig
cd vim/src/
make distclean # If you build vim before.
make
make test # Optional, may take a long time.
sudo make install
Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.vimrc ~/
Open Vim and plugins will be automatically installed by vim-plug.
vim
Upgrade Vim.
sudo apt upgrade vim
If installed with Homebrew, run
brew upgrade vim
Pull the repo.
cd vim
git pull
If Makefile
locally changed.
cd vim
git stash
git pull
git stash pop
Build again.
Uninstall Vim.
sudo apt remove --purge vim
sudo apt autoremove
If installed with Homebrew, run
brew uninstall vim
make uninstall_runtime
YouCompleteMe 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-completer
YouCompleteMe 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 tmux
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
Create a symbolic link to update configuration.
ln -sf /home/xianwen/.dotfiles/.tmux.conf ~/
Upgrade Tmux.
sudo apt upgrade tmux
Uninstall Tmux Plugin Manager.
rm -rf ~/.tmux/
Uninstall Tmux.
sudo apt remove --purge tmux
sudo apt autoremove
brew install bat
Or 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/bat
Or 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.deb
brew install bat-extras
Create 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 bat
If installed with apt, run
sudo apt upgrade bat
Upgrade bat-extras.
brew upgrade bat-extras
Remove 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-extras
Uninstall bat.
brew uninstall bat
If installed with apt, run
sudo apt remove --purge bat
sudo apt autoremove
Install fd.
brew install fd
Or 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/fd
Upgrade fd.
brew upgrade fd
If installed with apt, run
sudo apt upgrade fd
Uninstall fd.
brew uninstall fd
If installed with apt, run
sudo apt remove --purge fd
sudo apt autoremove
brew install bat ripgrep the_silver_searcher perl universal-ctags
brew install fzf
Or install with apt, but the version is too old.
sudo apt install fzf
Create 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 fzf
If installed with apt, run
sudo apt upgrade fzf
Remove the setup of fzf in shell config (e.g., ~/.bashrc
, ~/.config/fish/config.fish
, ~/.zshrc
, etc.) before uninstall.
Uninstall fzf.
brew uninstall fzf
If installed with apt, run
sudo apt remove --purge fzf
sudo apt autoremove
brew install lazygit
Upgrade Lazygit.
brew upgrade lazygit
Uninstall Lazygit.
brew uninstall lazygit
sudo apt install bear
sudo apt upgrade bear
Uninstall bear.
sudo apt remove --purge bear
sudo apt autoremove
In included file: 'bits/libc-header-start.h' file not found
sudo apt install gcc-multilib
git clone https://github.com/pwndbg/pwndbg
cd pwndbg
./setup.sh
Remove the source line in the .gdbinit
file, then remove the pwndbg
folder to uninstall.
rm -rf ~/downloads/pwndbg/
sudo apt instal rustup
Then install cargo
, and rustc
.
rustup default stable
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Then 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 rustup
If installed with curl, run
rustup update
Uninstall rustup.
sudo apt remove --purge rustup
sudo apt autoremove
If installed with curl, run
rustup self uninstall
error: failed to run custom build command for openssl-sys v0.9.105
sudo apt install pkg-config libssl-dev
brew install pipx
Or install with apt, but the version is too old.
sudo apt install pipx
Create 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 pipx
If installed with apt, run
sudo apt upgrade pipx
Remove the setup of pipx in shell config (e.g., ~/.bashrc
, ~/.config/fish/config.fish
, ~/.zshrc
, etc.) before uninstall.
Uninstall pipx.
brew uninstall pipx
If installed with apt, run
sudo apt remove --purge pipx
sudo apt autoremove
Command 'register-python-argcomplete' not found
Install argcomplete
, run pipx completions
for more details.
pipx install argcomplete
pip install pqi
pip install --upgrade pqi
Uninstall pip registry manager.
pip uninstall pqi
brew install fnm
curl -fsSL https://fnm.vercel.app/install | bash
Create 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 --lts
brew upgrade fnm
If installed with curl, run
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell
Upgrade Node.js, rerun
fnm install --lts
fnm 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 fnm
If 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 --lts
PROFILE=/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 --lts
Remove 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.conf
Install npm registry manager.
npm install -g nrm
Update npm registry manager.
npm update -g nrm
Uninstall npm registry manager.
npm uninstall -g nrm
Install Yarn registry manager.
npm install -g yrm
Update Yarn registry manager.
npm update -g yrm
Uninstall Yarn registry manager.
npm uninstall -g yrm
Search for the latest version of PowerShell.
winget search Microsoft.PowerShell
Install PowerShell.
winget install --id Microsoft.Powershell --source winget
Check available PowerShell upgrade.
winget list --name PowerShell --upgrade-available
Upgrade PowerShell.
winget upgrade --id Microsoft.Powershell --source winget
Uninstall PowerShell.
winget uninstall --id Microsoft.Powershell --source winget
winget install starship
Copy 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/PowerShell
Upgrade Starship.
winget upgrade starship
Remove the initialization of Starship in $PROFILE
before uninstall.
Uninstall Starship.
winget uninstall starship
winget install JanDeDobbeleer.OhMyPosh -s winget
oh-my-posh font install
Or 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/PowerShell
Get-PoshThemes
oh-my-posh upgrade
winget upgrade JanDeDobbeleer.OhMyPosh -s winget
To enable automated upgrade, run
oh-my-posh enable upgrade
Remove the setup of Oh My Posh in $PROFILE
before uninstall.
Uninstall Oh My Posh.
winget uninstall JanDeDobbeleer.OhMyPosh -s winget
Install-Module posh-git -Scope CurrentUser -Force
Copy 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/PowerShell
Update posh-git.
Update-Module posh-git
Remove the setup of post-git in $PROFILE
before uninstall.
Uninstall posh-git.
Uninstall-Module post-git
Install-Module PSReadLine -Scope CurrentUser -Force
Copy 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/PowerShell
Update-Module PSReadLine
Remove the setup of PSReadLine in $PROFILE
before uninstall.
Uninstall PSReadLine.
Uninstall-Module PSReadLine
winget install nushell
Upgrade Nushell.
winget upgrade nushell
Uninstall Nushell.
winget uninstall nushell
winget install fzf
Upgrade fzf.
winget upgrade fzf
Uninstall fzf.
winget uninstall fzf
winget install lazygit
Upgrade Lazygit.
winget upgrade lazygit
Uninstall Lazygit.
winget uninstall lazygit