wsl -l -v # List all installed distros with version wsl --unregister Ubuntu # Remove old Ubuntu instance (⚠️ data loss) wsl --install -d Ubuntu-24.04 # Install fresh Ubuntu wsl -s Ubuntu-24.04 # Set Ubuntu as default distro
检查默认 Shell
1 2
echo $SHELL # Show current shell cat /etc/shells # List available shells
更新和升级软件包
1 2
sudo apt update sudo apt upgrade -y
安装 Fish Shell + 实用工具
1 2
sudo apt install fish -y sudo apt install w3m -y # Terminal web browser (for fish_config preview)
注册 Fish 到可用 Shell
1
cat /etc/shells # Verify fish is listed (usually /usr/bin/fish)
切换到 Fish
1 2
fish # Start fish session chsh -s /usr/bin/fish # Set fish as default login shell
⚠️ In WSL, chsh sometimes doesn’t persist. If it doesn’t stick:⚠️ 在 WSL 中, chsh 有时不持久。如果它不固定:
- Create/edit `~/.wslconfig` (Windows side) or use a `.profile` hack to auto-start fish.
在 Windows 端创建/编辑 `~/.wslconfig` 或使用 `.profile` 小技巧自动启动 fish。
验证已安装的软件包数量
1
grep -i "installed" /var/log/dpkg.log | wc -l
配置 Fish
1
fish_config
Opens a web UI (served locally).打开一个网页界面(本地服务)。
Requires w3m or browser to preview themes.需要 w3m 或浏览器来预览主题。