Wednesday, July 13, 2005

Cygwin Tips

I added some tips for using Cygwin to the Cygwin entry at Wikibooks. I'm going to repeat them here for my own reference and the benefit of other Cygwin users.

  • Install Cygwin to the default directory, C:\cygwin for consistency.
  • When installing, check cygrunsrv to allow for running sshd as a Windows service
  • To use rxvt as the preferred console:
    • Create a Windows shortcut with the Target set to C:\cygwin\bin\rxvt.exe --loginShell -sr and Start in set to C:\cygwin\bin.
    • To enlarge the console window and add a title, add -geometry "80x50" to the Target.
    • To add a title, add -title Cygwin to the Target.
    • To adjust the colors, try -bg black -fg white
    • To start an SSH session, add -e ssh to the Target.
  • To change the default home directory to My Documents:
    • Create an environment variable called HOME with value of C:\DOCUME~1\USERNAME\MYDOCU~1 (where USERNAME is your Windows login username).
    • Edit /etc/passwd and change /home/username to /c/DOCUME~1/USERNAME/MYDOCU~1 (like the HOME variable)
  • Create an environment variable called SHELL with value of /bin/bash.
  • Create an environment variable called CYGWIN with value of binmode ntsec tty.
  • Make sure c:\cygwin\bin; is added to the Path environment variable.
  • To change the mount prefix from /cygdrive to / type this command once, mount -s --change-cygdrive-prefix /
  • Or keep cygdrive as is and create symbolic links (e.g. ln -s C: /C) for every drive.
  • Emacs and vi are the most popular editors but Nano is the easiest to use.
  • Create a file called .bash_profile in the HOME directory containing the following lines:
    • alias dir='ls -lav --color=auto'
    • EDITOR=nano; export EDITOR
    • VISUAL=nano; export VISUAL