20

I'm running Cygwin 1.7.17 on Windows Server 2012. My user account is "Administrator". Where should I put a .bashrc file for the Cygwin bash to pick it up?

I've tried the "c:\users\Administrator" folder, which seems to be the HOME in Cygwin 1.7. Tryed c:\cygwin\home\Administrator also.

Costa
  • 2,043
  • 1
  • 14
  • 27
Eliezer Kohen
  • 469
  • 1
  • 4
  • 9

1 Answers1

33

Start a shell instance and run the command echo $HOME to see what your home path is set to. That's where all your user config files will be read from. It might not be one of the paths you tried.

Once you know where it is, just copy the template .bash_profile and .bashrc files from the /etc/skel folder to get you started.

If you don't like the path that's currently being used as your home, you can change it by editing /etc/passwd. Here's more info on that... Safely change home directory

Community
  • 1
  • 1
Costa
  • 2,043
  • 1
  • 14
  • 27
  • 2
    `echo $HOME` shows `/cygdrive/c/Users/Administrator` , but putting .bashrc in c:\Users\Administrator does not work - I've put `echo TEST` in the file, but nothing is printed on login – Eliezer Kohen Feb 20 '13 at 11:57
  • 8
    Have you copied the .bash_profile template to your home too? It contains all the logic to source .bashrc when. Make sure to add it if you don't already have it. `cp /etc/skel/.bash_profile $HOME` – Costa Feb 20 '13 at 14:45
  • `cygpath -w ~` will show you the windows path `c:\cygwin64\home\administrator` – Eskil Mjelva Saatvedt Nov 16 '20 at 09:44
  • `bash: cd: /etc/skel: No such file or directory` -> Turns out, you have to run `cygpath -w /etc/skel` as administrator. For some reason, it still does not exist and I cannot `cd` into it. – Domi Apr 27 '21 at 08:16