Location of .bashrc for “Bash on Ubuntu on Windows” in Windows 10

后端 未结 6 747
攒了一身酷
攒了一身酷 2020-12-08 04:25

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.

相关标签:
6条回答
  • 2020-12-08 05:05

    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 find it there : http://www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/


    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 :-)

    0 讨论(0)
  • 2020-12-08 05:05

    ~ means that is user home folder, way like /home/%username%/

    you can list files like ls -al and see .bashrc file.

    0 讨论(0)
  • 2020-12-08 05:13

    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.

    0 讨论(0)
  • 2020-12-08 05:16

    I find my .bashrc file in:

    /home/your_user_name
    

    you can run cd /home/your_user_name or cd ~ should work as well

    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/.bashrc However, modifying that file only works for git bash in window but not for the shell terminal of the Linux subsystem.

    Note: my installation of the Ubuntu is 20.04 LTS straight from window store.

    0 讨论(0)
  • 2020-12-08 05:21

    Right now on WSL 2 you can find it under /home/{user_name} and the file is hidden.

    You can access it from Ubuntu console by {text_editor} .bashrc

    If you want to edit that in Windows just type in ubuntu console explorer.exe . and it opens the current folder and shows all hidden files. It's weird but works fine.

    0 讨论(0)
  • 2020-12-08 05:28

    just type vi ~/bashrc and that should put you into the file where ever it is. You can navigate there simply by doing cd ~ List all files with ls -a and you should be able to see it.

    0 讨论(0)
提交回复
热议问题