WSL Personal Case Notes
This page is specifically for command snippets that are more tied to personal environments. They may not be suitable for direct copying to another machine, but keeping them here is at least clearer than mixing them into the main tutorial.
What Belongs on This Page
- Port numbers that clearly depend on your own machine's habits
- Fixed configuration methods for a specific proxy software
- A specific distribution name, directory structure, or working drive letter
- One-time migration command snippets
The main pages only keep general methods that "others can also reuse"; this page allows preserving a stronger environment-specific flavor.
Proxy Toggle Function Example
If you consistently use a local proxy on Windows with a fixed listener on 7890, you can keep this simplified function:
proxy-on() {
local host_ip
host_ip=$(ip route show default | awk '{print $3}')
export http_proxy="http://$host_ip:7890"
export https_proxy="http://$host_ip:7890"
export all_proxy="socks5://$host_ip:7890"
}
proxy-off() {
unset http_proxy
unset https_proxy
unset all_proxy
}
This type of content is suitable for your personal shell configuration, but not for hardcoding directly into the main tutorial text.
PowerShell Snippet for Refreshing portproxy
If you frequently need other LAN machines to SSH into WSL, you can save this type of script as your own tool script:
$distro = "Ubuntu"
$listenPort = 22
$wslIp = wsl -d $distro -- bash -lc "hostname -I | awk '{print \$1}'"
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=$listenPort
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=$listenPort connectaddress=$wslIp connectport=22
netsh interface portproxy show all
This type of script is great for personal reuse, since WSL IP changes are a frequent issue.
Backup Naming Convention Example
I prefer to include the date in backup filenames rather than just the distribution name:
wsl --export Ubuntu D:\WSL\backup\Ubuntu-2026-04-15.tar
This makes it easier to distinguish when multiple versions are kept in the same directory later.
What This Page No Longer Contains
After this refactoring, I no longer recommend keeping the following content directly in the repository:
- Full SSH public keys
- Identifiable machine names
- Fixed private IPs
- Path details that expose personal usage habits
If a placeholder is truly needed, use a uniform placeholder format, for example:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleOnlyReplaceWithYourOwnKey your_name@your_host
Usage Principles
- Main documentation first covers general solutions
- Personal snippets go in the case notes page
- When a "personal experience" gradually becomes a stable pattern, consider moving it back to the main page