This is a collection of useful customization tips for Cygwin. Personally, I find them really helpful and bring my favorite tools in Windows.
I ‘ll try to keep updating this post with various tips that I find useful.
Why use Cygwin?
You might ask, why don’t I switch to an actual Linux distro? The reason is that I have to develop certain things on Windows and since I am fairly accustomed to various UNIX tools, Cygwin is the only option.
Tip #1 Ctrl+arrow navigation
If you like to navigate in the terminal on per word fashion with Ctrl+arrow, do the following:
Add the following lines to .inputrc
(Windows explorer: C:\[cygwinhome]\<username>\.inputrc or Cygwin: ~/.inputrc):
"e[1;5C": forward-word # ctrl + right "e[1;5D": backward-word # ctrl + left
Reload the .inputrc file. You can do this by restarting Cygwin or at runtime (i.e. in Cygwin terminal) by executing:
Tip #2 Open bash-prompt here
If you want to open the terminal in a certain folder, a context-menu option comes really handy compared to navigating via command line. Especially in windows, where accessing your folder requires starting the path from “/cygdrive/..”. I use a similar context option in my Ubuntu environment, i.e nautilus open-in-terminal.
Install the chere package under the “Shells” category. You need to run the initial setup executable to add new packages to an existing installation.
Open up a Cygwin terminal (as an administrator) and type the command:
chere -i -t mintty
Note: The context-menu option does not work when you access a folder via the Libraries in windows explorer
Tip #3 Color in grep results
If you want to enhance readability in your grep results you can set the grep color argument to `auto`. In my Linux distro this default, but not in Cygwin.
Add the following lines to .bashrc (Windows explorer: C:cygwinhome<username>.bashrc or Cygwin: ~/.bashrc):
alias grep=grep --color=auto
Reload the .bashrc file. You can do this either by restarting Cygwin or at runtime (i.e. in Cygwin terminal) by executing:
Tip #4 Clear command
The clear command is not available by default in the Cygwin terminal. So:
Install the ncurses package. You need to run the initial setup executable to add new packages to an existing installation.