Код отслеживания Google Analytics.

Mar 7, 2009

Cygwin terminals

A standard Cygwin terminal is not the only one possible. Like most of programs, it has deficiencies - there is no usual operations of copy/paste, in which the text is put directly into the clipboard as soon as it was selected, a fairly limited set of fonts etc. - but in general it will meet most of your queries. From other hand, this is world of open source, so no need to limit yourself by one program.



(the old Russian version can be found here)
All terminals are described below, have a common functionality - like in most *nix standart terminal programs the selected text is already into copy/paste buffer - it means you don't need press any key to copy text to clipboard just select the text - et voila - you can paste it anywhere. The past operation for the terminals is associated with mouse wheel - just press it in terminal window.
rxvt
This is real linux terminal which can be found in Cygwin repository. A huge number of options makes it a very flexible tool in capable hands. Probably the simplest way to create new icon with the following command:
C:\cygwin\bin\rxvt.exe -sr -sl 10000 -fg black -bg white -geometry 150x50 -e /bin/bash --login -i
where
C:\cygwin\bin\rxvt.exe - full path to rxvt
-sr - scroll bar at right side
-sl 10000 - terminal "history" size
-fg black - foreground color
-bg white - background color
-geometry 150x50 - size in characters (<width>х<height>)
-e /bin/bash --login -i - the command which has to be executed.
The same result can be expected if edit ~/.Xresources be adding the following:
rxvt.geometry:        150x50
rxvt.scrollBar:       True 
rxvt.visualBell:      True 
rxvt.loginShell:      True 
rxvt.background:      White 
rxvt.foreground:      Black  
rxvt.saveLines:       10000 
rxvt.scrollBar_right: True

in this case the command can be reduced to
C:\cygwin\bin\rxvt.exe -e /bin/bash --login -i

The following example will show how you can define font for terminal:
C:\cygwin\bin\rxvt.exe -fn "Lucida Console-12" -e /bin/bash --login -i

This is parameter can be also placed in ~/.Xresources file
rxvt.font:              -*-fixed-*-*-*-*-13-*-*-*-*-*-koi8-*

rxvt can be started like normal Windows application and as X Client - the same as xterm (see bellow). In first case rxvt reads his own preferences from ~/.Xresources, in second - you have to worry about the configuration was loaded in resource base (you can find example bellow in xtrem section). The fonts probably is bottleneck of this approach - they are looks different under X Server and Windows. That is why I use both form - command line for Windows mode and config file for X Client mode.
xterm
It is one of the oldest terminal emulator and same as previous it was ported under Cygwin. But it works only as "X Client" and you must to have started "X Server" to work with it (you can find here more information about X Client and X Server and here how Cygwin X Server can be started under Windows). The same as rxvt you can start it either define its parameters in command line or in ~/.Xresources. My .Xresources contains the following set of strings:
XTerm.color0: #000000
XTerm.color1: #B21818
XTerm.color2: #18B218
XTerm.color3: #BE5F00
XTerm.color4: #6D85BA
XTerm.color5: #B218B2
XTerm.color6: #18B2B2
XTerm.color7: #B2B2B2
XTerm.color8: #686868
XTerm.color9: #FF5454
XTerm.color10: #54FF54
XTerm.color11: #FFFF54
XTerm.color12: #73A5FF
XTerm.color13: #FF54FF
XTerm.color14: #54FFFF
XTerm.color15: #FFFFFF
XTerm.background:#FFFFFF
XTerm.foreground:#000000

*.VT100*scrollBar:        true
*.VT100*loginShell:       true
*.VT100*font:             -*-fixed-*-*-*-*-12-*-*-*-*-*-koi8-*

*.VT100*visualBell:       true
*.VT100*saveLines:        10000
*.VT100*rightScrollBar:   true
*.VT100*geometry:         130x40

Since the launch of X Server under Cygwin can be done in numerous of different ways, make sure that in your case resources file for xterm was loading to a common basis. This can be also done by hand, using the following command:
xrdb -merge ~/.Xresources

Also worth to check that your locale is properly configured. This is especially important for Cygwin, from which this notion of complete confusion. In case of Russian as second language make sure the environment variable LANG is defined and has a value of ru_RU.KOI8-R, rather than just ru. This will allow you to see and to use Russian characters in xterm.
Terminator
The terminal is somewhat slow to load, written in java and determines the mass of non-standard approaches. But there is one feature that makes this product very attractive - it has tabs. When you work with a large number of terminals, the tabs simply indispensable. However his value was significant reduced since the screen was ported under Cygwin.

6 comments:

Anonymous said...

...written IN Java.

Beggy said...

Sure. Fixed. Thank you!

Unknown said...

MinTTY is an awesome terminal emulator, too.

Beggy said...

Hi to Biker :)
MinTTY is something new. Thank you - I will investigate it as soon as possible and write report

Nick said...

Hi!
Just came across your page while looking for help on seeing filenames in russian in cygwin - when I open cmd and do dir - the filenames are ok, but when I try to do it with rxvt or even, when running bash from its' default cygwin definition - I get ? instead of russian letters. Do you how to solve such a problem?

Beggy said...

Hi Nick,
as far as I know Cygwin has locale issue during all it's history. I don't know any solution for you problem (and not only me http://www.zsh.org/mla/workers/2000/msg03159.html), but if you will sort out it please let me know.