Better Cygwin Terminal

mintty is an option -- http://code.google.com/p/mintty/

"Mintty is a terminal emulator for Cygwin and Cygwin derivatives such as MSYS. It can be downloaded from here or it can be installed through Cygwin's setup.exe program, where it can be found in the Shells category. The Cygwin installer creates a shortcut for mintty in the Windows start menu."


If you use CygWin, the default terminal (which is a Windows console program) will give you the following problems:

AdewaleOshineye has this excellent recommendation, which fixes all of the above:

Make sure rxvt is part of your Cygwin install, and update your C:\cygwin\cygwin.bat to this:

 @echo off
 C:
 chdir \cygwin\bin
 start rxvt -sr -sl 10000 -fg white -bg black -fn fixedsys -fb fixedsys -tn cygwin -e /bin/bash --login -i

(If you don't want the first window hanging around)

 @echo off
 C:
 chdir C:\cygwin\bin
 set EDITOR=vi
 set VISUAL=vi
 set CYGWIN=codepage:oem tty binmode title
 rxvt -sr -sl 10000 -fg white -bg black -fn fixedsys -fb fixedsys -tn cygwin -e bash --login -i

(Added 2005-03-31)

Once that's done you'll have a real unix terminal app running on windows. (the -fn, -fb and -tn flags are so the font size is the same as the standard Cygwin window. The value of $TERM is now cygwin.)

For a visual colour chart, most of the names from http://users.rcn.com/giant.interport/COLOR/1ColorSpecifier.html seem to work (eg: '-fg FireBrick4 -bg OldLace?')

Current TODO's:

Put the absolute minimum in that cygwin.bat file and use the UN*X mechanisms for setting your environment. ${HOME}/.Xdefaults is the place for setting the rxvt terminal look-and-feel, and ${HOME}/.profile is the right place for setting environment variables such as ${EDITOR}. (${HOME} is /cygdrive/c/documents and settings/my.name for example). Even though .Xdefaults is an X11 file, rxvt will look for it and fetch resources from there even if you are not using X. The only variable you need to set in cygwin.bat is ${SHELL} to make sure the right one is used at startup. Here are my startup files:

C:/cygwin/cygwin.bat:-

 @echo off
 C:
 chdir C:\cygwin\bin
 set SHELL=/bin/ksh
 rxvt --loginShell -sr

${HOME}/.Xdefaults
 Rxvt*background: #000030
 Rxvt*foreground: wheat
 Rxvt*scrollBar_right: true
 Rxvt*saveLines: 1000
 Rxvt*font: 16
 Rxvt*cursorColor: white
 Xterm*background: #000030
 Xterm*foreground: wheat


Font size is changed by replacing the -fn [font] with -fn [size]-[font], eg "-fn 18-Terminal". Quotes can be added around the size and font name if needed for multiple word fonts.


If you use a dark background, a bold font might look better. For windows fonts, the font string is like this: "Lucida Console-bold-12" ... or in general, [fontname]-[style]-[size] (Added 2005-04-30)


An alternative, which does not require you to run an X server, is to run sshd and use PuTTY to ssh to localhost. PuTTY is a telnet/rlogin/ssh client with a decent xterm-like terminal emulator. http://www.chiark.greenend.org.uk/~sgtatham/putty/

There is also a patched version of PuTTY which opens a local Cygwin tty directly. http://gecko.gc.maricopa.edu/~medgar/puttycyg/ Use a single dash (-) as the hostname.

I've had trouble when using PuTTY to ssh into a cygwin box where the default TERM of xterm doesn't work very well with mc and a TERM of putty doesn't work with less. Thanks to a suggestion on this page I tried rxvt for TERM and it works great for both mc and less.

It is worth noting that MinGW (more precisely MSYS, an additional package) uses rxvt out of the box and without an X server. Is it as good as the Cygwin rxvt?


Another alternative, which also doesn't require X11 (but does require a JVM), is http://software.jessies.org/terminator/ (which also works locally, like rxvt). The Terminator FAQ contains various Cygwin-related hints and tips, because many of Terminator's users are Cygwin users.


I get adequate terminal settings when I ssh to somewhere from within a cygwin bash window. This seems to work for me in the BourneShell, ksh, or bash:
 TERM=ansi
 export TERM
or maybe for you in csh or tcsh:
 setenv TERM ansi


I've had better luck set my TERM to xterm. Less and vim work beautifully. -- PiranMontford

 export TERM=xterm


The flash of the DOS window can be avoided by creating a Windows shortcut where the shortcut target is:

 %CYGWIN_HOME%\bin\rxvt.exe -sr -sl 10000 -fg white -bg black -fn fixedsys -tn cygwin -e /bin/bash --login -i


Changing the the TERM environmental variable from cygwin to rxvt enables mc (Midnight Commander). Perhaps this is the preferred setting when running rxvt.

Same is true for running emacs.

This shortcut uses the -tn option to start rxvt with TERM set to rxvt:

 %CYGWIN_HOME%\bin\rxvt.exe -sr -sl 10000 -fg white -bg black -fn fixedsys -tn rxvt -e /bin/bash --login -i


Any commands to make rxvt run full screen size?

Use the -geometry option to make rxvt start with a given window size:

 -geometry 110x40+70+50
The geometry is specified as wxh+l+t (where width w and height h appear to be expressed in terms of number of characters and left l and top t appear to be expressed in screen pixels)

Experiment with different values until you find one that's close to "full screen size" for your computer...

This works for me: rxvt -geometry 110x40+670+50 -sr -sl 10000 -fg white -bg black -fn fixedsys -tn cygwin -e /bin/bash --login -i --AdewaleOshineye


How to get multiple sessions in one window? Like terminal-oriented Unix could use <Alt+2> <+3> etc. to swap between various command lines. (I don't like using cd while navigating around, so I leave one console open in each folder of interest.) --PhlIp

To get multiple sessions in one window, try screen, it does that and much more. I got it from here: http://dellelce.com/code/screen/ unfortunately the ability to disconnect from a screen session and reconnect later ( a wonderful feature e.g. go home and connect back via ssh from home to the 10 open shells you had running, all exactly how you left them at work) doesn't work on Windows

: There is now a screen cygwin package. Works on Windows.

Thanks! And now I get "/etc/ttys: No such file or directory". What's the stupidest command that will open a new shell in the current window? The author did not seem to document this tidbit anywhere...


rxvt copy/paste behaviour

From the rvxt documentation:

The behaviour of text selection and insertion mechanism is similar to xterm(1).

Selection: Left click at the beginning of the region, drag to the end of the region and release; Right click to extend the marked region; Left double-click to select a word; Left triple-click to select the entire line.

Insertion: Pressing and releasing the Middle mouse button (or Shift-Insert) in an rxvt window causes the current text selection to be inserted as if it had been typed on the keyboard. Holding down shift and clicking the left mouse button will also paste.

Is it possible to modify this rxvt behaviour, so that mouse right-click will paste instead of extend (without running an X server)?


If the white is too bright

The white is too bright for me. I changed 'white' in the command to 'grey' and now it looks just like PuTTY.


Your term windows just flash and immediately disappear when trying to run from a batch file

If you've upgraded Cygwin (I'm using setup.exe version 2.763), you might find that batch files that once brought up an rxvt term window with bash no longer work...they just "flash" and disappear. Turns out that you now need a full path for any argument to the -e option. (Several examples on the internet simply use '-e bash -l -i'...this appears to no longer work, at least with newer versions of Cygwin.)

Your shortcut target should look something like this to resolve the immediate exit problem:

 C:\cygwin\bin\rxvt.exe -sl 1500 -fn "Lucida Console-14" -bg black -fg grey -sr -e C:\cygwin\bin\bash.exe --login -i


See: CygWin, BetterCygwinWindows, PoderosaTerminal.


CategorySoftwareTool


EditText of this page (last edited July 5, 2012) or FindPage with title or text search