Closed mbl-35 closed 2 years ago
Instead of having the hosting machine hostname in the bash prompt, set the wsl instance name in prompt by default.
Add in a /etc/profile.d script :
/etc/profile.d
# Wslname in PS1 PS1="\[\e]0;\u@$WSL_DISTRO_NAME: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@$WSL_DISTRO_NAME\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
Better use the /etc/wsl.conf, and set the hostname parameter in the [network] section. Thus, PS1 env variable is unchanged, and this works even if zsh or other is used.
/etc/wsl.conf
hostname
[network]
PS1
Instead of having the hosting machine hostname in the bash prompt, set the wsl instance name in prompt by default.
Add in a
/etc/profile.d
script :