So, I have 2 users in my Ubuntu WSL, and if I try to run code .
, when the wsl opens in the main user as default it works fine, but when I switch to second user using su second_user
, then running code .
gives the following error:-
Command 'code' not found, did you mean:
command 'tcode' from deb emboss (6.6.0+dfsg-11ubuntu1)
command 'ode' from deb plotutils (2.6-11)
command 'cde' from deb cde (0.1+git9-g551e54d-1.2)
command 'node' from deb nodejs (12.22.9~dfsg-1ubuntu3)
command 'cdde' from deb cdde (0.3.1-1build1)
Try: sudo apt install <deb name>
Then, if I go back to my previous user, then it stops working there as well, and gives the same error.
So, a fix that I found for my situation was to change the default user of the WSL, by entering the following command in PowerShell of windows.
ubuntu config --default-user second_user
Where the general syntax of the command will be:-
<distro_name> config --default-user <username>