How to change default directory with WSL/BASH on every time you launch your WSL on Windows 10. How make your user directory default directory every time your launch your BASH or WSL like Ubuntu, Debian, Apline, Arch Linux, Fedore, Suse, and other Linux distro.
To make this permanent default directory whenever you launch your WSL terminal, you’ll have to edit your .bashrc file with your favorite editor like nano or vim.
I’ll be using Micro ‘a terminal based text editor’ more like nano but Micro is a little more feature rich.
Launch Your WSL Terminal
I have launched my Ubuntu WSL 2 and it opens in Ubuntu home/user directory, which your check by running this pwd command, this tells you the current directory you are in.
To Get into Windows Directory
To change into your Windows directory, you have to change many directories which is time consuming and nobody wants waste time like that.
To manually change the directory, you type the following commnad
To Make it Default WSL BASH Directory
Run the following commands, type the following commands in your WSL terminal.
The above command will take you to /home/user_folder
I’ll be using Micro text editor, you can use nano or vim
sudo micro .bashrc
Run the above command and enter your password and it should open your .bashrc file.
Type the following command to launch your BASH WSL terminal in your choice of directory.
Change /User_Name with your username; save the file and exit.
Okay, you are done. Just relaunch your WSL terminal.