Aliases are not working in Kali Linux in WSL


#1

I’m currently using Windows 10’s feature for running Linux distributions, as described in Chris Hoffman’s article. Specifically, I’m running Kali Linux on Windows 10. I discovered an issue while trying to create a new alias to automatically switch to a project directory of mine. I added the alias to the .bashrc file in my home directory as follows:
alias proj=‘cd /mnt/c/Users/[my username]/Desktop/School/NetSec’
with [my username] replaced by my actual username, of course. You’ll have to take my word for it that everything exists and is spelled correctly.
However, the alias wasn’t working. I tried uncommenting some of the example aliases in the file (such as alias ll=‘ls -l’), but those didn’t work either. Further testing revealed that the .profile file, which was supposed to automatically add the bin in my home directory to the path, was also not working; the path remained unchanged. To me, this looks like the issue is that the startup files in my home directory aren’t being properly read at startup.
I’m not sure if the issue is the result of using the Windows software, or if it stems from some other source; regardless, until I get it fixed, I won’t be able to make new scripts or aliases. Does anyone know how I can make sure these files get read at startup, and do what they are supposed to do?


#2

May I ask some preliminary questions?

  • Does this error occur after installing Kali Linux?
  • Did you add any user or there is only root user?
  • Try to add a dummy user to test your aliases.
  • Did you try it in other distro?

By the way, due to many limitations, Kali becomes Debian in Windows Subsystem For Linux (WSL).


#3

Thank you very much for your help! Not sure which of your fixes did the trick (I was testing several), but the files are being read properly now. Thanks again!