You can access the root of your C: drive, for example, from cygwin by specifying the directory /cygdrive/c
, e.g.,
$ cd /cygdrive/c
Similarly, the path to any file on your C: drive can be constructed by prefixing the Windows path (without the "C:" and with \s changed to /s) with /cygdrive/c
, so C:\Dropbox\myfile
would be accessed from within Cygwin as /cygdrive/c/Dropbox/myfile
.
Cygwin is intended primarily to provide a Linux-like environment on top of Windows. It works best with programs that are compiled for Cygwin. It can work directly with native Windows programs, but you have to be careful.
One feature of Cygwin is that it tries to make the Windows file system look like a typical Linux file system, e.g., programs are under /usr/bin. Cygwin programs don't refer to the C: drive, they refer to /cygdrive/c. (Some Cygwin programs understand "C:" but those are the exception.) While your home directory appears under C:\cygwin\home from Windows, it appears under /home from Cygwin. That means that passing full path names between Cygwin programs and Windows programs can be tricky: Windows programs don't understand Cygwin full path names and Cygwin programs generally don't understand Windows full path names. There's a Cygwin utility, cygpath, that can translate between Windows and Cygwin paths, but you do have to insert that level of translation yourself as necessary.
I don't know of a general solution to the problem of interfacing Cygwin programs with Windows programs. The best solution depends on what you're trying to do, on how much you want to live in the Linux world vs. living in the Windows world, and on the programs you need to use.
If you're planning to use Mercurial, Vim, Git, etc. from the Cygwin command line, I would recommend installing the Cygwin versions of those programs. You can have both Windows and Cygwin versions on your system, but you have to be careful with your PATH.
I tried configuring Windows gvim to use the Cygwin shell and finally gave up. I now use Windows gvim when opening files from the GUI and Cygwin vim when opening files from the command line. There are just too many places within Windows Vim where conventions of the Windows OS API have to be matched to the Cygwin conventions of external programs. That said, using the same user configuration files for both is easy. In a Cygwin bash shell:
ln -s /cygdrive/c/Documents\ and\ Settings/username/_vimrc ~/.vimrc
ln -s /cygdrive/c/Documents\ and\ Settings/username/vimfiles ~/.vim
You just have to make sure that all those files have Unix line endings and use d2u
on those that don't. Cygwin's Vim (any Unix Vim) expects Unix line endings; Windows Vim accepts either Unix or DOS line endings.
I have used Cygwin quite a bit, but I'm not an expert. The above just reflects my experiences.
Best Answer
First of all make sure your domain user is added to
/etc/passwd
:Then just edit
/etc/passwd
and let it point to your desired directory. For example my entry looks as follows:This places the cygwin home directory within my roaming profile folder within my user profile.