Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location of .bashrc for "Bash on Ubuntu on Windows" in Windows 10

Microsoft just introduced a Linux subsystem in its Windows 10 Anniversary Edition. The installation is pretty straight forward, but I could not locate bash files on Windows.

How does it work? What does ~ refer to in Windows? Where to find .bashrc?

like image 236
Meet Taraviya Avatar asked Nov 26 '16 17:11

Meet Taraviya


People also ask

Where is bash bashrc in Windows?

With the bash on windows the files are located at in the same location if you are running within the bash environment, ie /home/user_name/. bashrc .

Where is bashrc Ubuntu Windows?

If you previously installed git bash for window, you may also find . bashrc file in your window user profile folder. In Linux subsystem, you may local the file under /mnt/c/Users/your_window_user_name/.

Where is the .bashrc file in WSL?

On Linux systems, . bashrc is found in the user's home directory. ~/. bashrc or "${HOME}"/.

How do I find the bash terminal in Windows 10?

Press Windows key + X then click Command prompt, at the command prompt, type: bash then hit Enter. If you want to be able to access the local file system, press Windows key + X, Command Prompt (Admin) then type bash at the prompt.


2 Answers

Since the Windows 10 Fall Creators Update, the location changed to:

C:\Users\USERNAME\AppData\Local\Packages\{DIST}\LocalState\rootfs\home\{LINUXUSER}\ 

Where:

  • {DIST} is equal to CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
  • {LINUXUSER} is the user for which you are looking for the .bashrc file

Just for anyone wondering that came here from Google.

like image 161
ncw Avatar answered Oct 05 '22 11:10

ncw


Sorry for the misunderstanding, I check on google and it will be at C:\Users\USERNAME\AppData\Local\Lxss\home\USERNAME .

I tried and it works, in the cmd just type cd\ && dir *bashrc* /s it will locate the file, and in my case i see the line C:\Users\USERNAME\AppData\Local\Lxss\home\USERNAME but when I want to navigate it with the window browser it doesn't work, but if you copy paste it, it works :-)

I found it here.


Considering that you need to know where a file is located you can use the find command.
The syntax of the command is find {search-path} {file-names-to-search} {action-to-take}by default the action to take is printing the file name.
So if you are finding .bashrc file you can use find / -name .bashrc the bash will return you /home/yourusername/.bashrc

Also, if you want to access to your home directory you can use cd ~
Hope my answer will be helpful :-)

like image 36
BinaryDump Avatar answered Oct 05 '22 11:10

BinaryDump