Posts Tagged ‘cygwin’
* virtuawin and clipx…
Posted on September 3rd, 2008 by doug. Filed under UNIX & Windows.
I tested a large number of clipboard history managers in windows, as well as several virtual desktop programs. There are two programs in KDE and one functionality I use all the time. In order to at least have some semblance of a sane working environment and not feel completely crippled in using Windows, duplicating this on windows was important to me.
Konsole – the KDE terminal program – can be duplicated by console2, with UNIX functionality added in on the backend by Cygwin.
Klipper, KDE’s clipboard and history program – to duplicate that functionality would require a searchable clipboard history available instantly. By default Windows has nothing like this. I tested a large number of programs before finding what worked best for me – clipx.
Some minor glitches – if the history setting is very large (800 plus entries) bringing it up for use can take several minutes. The solution is to set a reasonable history – 250 entries seems to be workable. The history is brought up by shift-ctrl-F3, and then searching is typing text within the search field in that window. Pasting depends on the windows program behavior – each individual program seems to be different. Sometimes clicking “paste” in the window will actually paste text in – for other programs it sets the current clipboard to that entry – but you will still need to shift-ins or right-click or whatever to actually paste.
This has some of the same risks as a clipboard history in KDE and your .bash_history file – if your system is compromised (hacked), data is kept available to be perused and used. Some caution is in order, be aware of this.
Multiple desktops – I had tried the desktop utility that came with the Windows Resource Kits back when I had a Microsoft Tech Net subscription (a long-time-ago). I tried various other free desktop products including a java-based program in the last several years. They mostly all worked but either had some odd way of reordering and dropping windows when shut down, or didn’t follow my method of working closely enough to be really useful.
One of the desktop programs – I can’t recall which, it didn’t stay on the machine very long – was unpredictable in behavior and occasionally made windows unusable. It required a reset of the machine to resolve, either a three finger salute (ctrl-alt-del) or a hard reset by holding the power button for ten seconds until it powered down.
virtuawin has turned out to be stable in over two years of use and to provide much of the functionality of UNIX desktops in KDE. I set up hot-keys to have ctrl-alt-1 bring up desktop #1, ctrl-alt-2 desktop #2, etc. I’ve been using a two-headed windows machine (two 1650×1400 LCD screens), and this hasn’t been as necessary as in the past. It still comes in very handy on a single head desktop or laptop.



— dsm
* TERM=vt220
Posted on August 29th, 2008 by doug. Filed under Uncategorized, shell.
console2 with cygwin bash shell and ssh behind it (and a lot of other UNIX commands too, like ls, and find and grep and awk and gpg…) has turned out to be a good solution.
I discovered that cygwin sets the terminal as TERM=cygwin. That plays hell with vi on SUN servers. I found that setting “export TERM=vt220″ in .profile (this is SUN Solaris 10) resolved vi, getting the console2 window to show the display correctly, and letting the arrow keys work again.
A second gotcha – DON’T set ctrl-c as copy in the hot-keys. That ctrl-c you use to break out of errant commands or scripts stops working at all, very disconcerting. Instead map shift-ctrl-c. There’s an alpha feature enabling tranparency – looks cool, but isn’t stable. Ctrl-r (history searching in bash) is mapped to renaming the tabs for console windows – you’ll set that to ctrl-alt-n as below and resolve that.
Here are the settings in console2 I’ve found to come very close to what I use in Konsole in KDE:
- base underneath is cygwin – therefore need “export TERM=vt220″ in .profile to have vi behave on SUN – run on command line initially to test and to edit .profile…
- add “c:\cygwin\bin to path in control panel -> system -> advanced -> environmental variables
- console:
- shell is c:\cygwin\bin\bash.exe
- working directory is c:\
- buffer size Rows is 5000, columns is 0
- appearance:
- more – set tabs to always be present (uncheck “hide single tab”)
- behavior:
- check copy on select
- check clear selection on copy
- select UNIX LF
- map hotkeys to emulate konsole
- shift-left for previous window
- shift-right for next
- ctrl-alt-n for new windows
- ctrl-alt-s for rename
- shift-up arrow for line up
- shift-arrow down for line down
- shift-page-up for page up
- shift-page-down for page down
- shift-ctrl-c for copy
- ctrl-v for paste
- mouse:
- right button to paste
- set copy on select
- left button to select
- copy/clear selection is “none”
- tabs:
- set shell as C:\cygwin\bin\bash.exe
- working directory is C:\
— dsm
UPDATE 20080904: I installed console2 on all of my windows machines (dual boot, except for work). It worked perfectly – then a co-worker tried it out and had issues. He searched and found that in some instances cygwin’s bash shell refused to complete loading and never returns a command prompt. The solution looks to be a reinstall or upgrade of cygwin, or possibly some difference in the way cygwin was installed.
I laughed and said, “It works for me.”
He said, “You can tell when you work in an IT shop – when something fails for someone, you always get that response – “It works for me.”"
Update 20090329 Sunday
export TERM=ansi
I installed eclipse with Remote System Explorer. vt220 caused VI to fail to refresh (at least SUN’s crippled vi version). ansi worked much better within RSE.
— doug
* console2…
Posted on August 28th, 2008 by doug. Filed under UNIX & Windows.
My ideal workstation to manage UNIX servers is kubuntu, running KDE.
I recently did a day of off-site work. I used a laptop running exactly that environment. I fell back in love with the terminal program Konsole. There are two primary reasons I use KDE instead of Gnome in the desktop wars. Konsole, and the ctrl-n for a new tab window, ctrl-s to name that tab, and shift-left / shift-right to move between windows, and Klipper, the searchable, expandable clipboard utility that by default appears in the system tray. And the select-and-copy, middle mouse button paste default behavior, that too, but that’s not KDE, that’s UNIX itself.
I could use kubuntu for the day because I was NOT expected to access email, nor did I need access to the change management software. I didn’t need access to internal sites that require Internet Explorer. Just for a day I could be a UNIX wonk.
Today, two days later, I’m feeling the loss. I have a linux workstation. From that workstation I have access to the systems I need to work with. What I don’t have is email access, Internet Explorer, access to the change management ticketing system, and on and on. I end up using the Windows XP workstation right next to it out of expediency. I CAN copy and paste data out of the ticketing system. I CAN create Microsoft Project updates. I CAN access the internal Instant Messaging system, I CAN get direct access to email, without switching systems [1]… Windows centric is windows centric.
My taskbar in windows is three labels deep. This is to accommodate the 15 to 25 or more ssh sessions running each in a separate window that appear by the end of each day. Each labeled with the name of the server to which it is connected. Finding a specific window, or in some cases another window to the same server, is a nightmare. I realized today that easily 60% to 80% of the clutter on the taskbar is ssh sessions. I looked out of desperation for KDE to run on windows. It does. Sort of…
A long time ago (2 years?) I found a KDE windows installer that ran on top of cygwin, as long as X11 was fully installed and configured. I got it all working together in a giant balancing act maybe twice. The package for KDE was never updated. The development took off on another direction, the KDE on Windows project. But that brief taste… It was good. Strange, seeing the full KDE desktop running within the Windows desktop. But within that environment I had Konsole, Klipper, multiple desktops.
I’ve been watching KDE on Windows for a while now. I tried it maybe a year ago. The installation process was a number of independent steps, all eerily reminiscent of configuring and recompiling a kernel. I completed about four steps, and determined to wait and watch and see where the project went. I waited. I downloaded and installed a version today – not bad. Once it completed installing I went to look for Konsole… Uh Oh.
Not there?! WTF?
I’m not the only one who wanted this. In searching for Konsole, or a way to install Konsole, I found that Konsole as written is deeply dependent on the whole UNIX X11 environment, and I found console2. Interesting. And after mapping a few hot-keys, I have a very close approximation of Konsole, running in windows. I added C:\cygwin\bin to my path, configured console2 to start with C:\cygwin\bin\bash.exe, and with cygwin providing the ssh binary, I can reduce my taskbar to two labels high instead of three. Very nice.
I still miss an agnostic work environment where provisions are made to make sure UNIX users can do corporate stuff too (imap or pop for email, evolution or web access for calendaring, a browser-based access to tickets, etc.). But this is good coping.
— dsm
Synergy… Another path to a solution.
There is a partial solution I’ve been playing around with at home – synergy. This program allows sharing keyboard and mouse between systems. Just put the separate monitors next to one another, assign one system as server and the other or others as secondary, tell it where the monitors are in relation to each other, start the server, connect a client, and go. It copys and syncs the clipboard between systems, which makes it a different approach to solving the same problems.
It does require two separate computers, two separate monitors, and a bit of effort…
* stupid shell (and UNIX) tricks
Posted on July 29th, 2008 by doug. Filed under shell.
I love using abobe photoshop C2’s automation – especially when resizing a series of images for the web. I would love to run linux entirely – but linux keeps falling short in graphics programs (yes, I use gimp – sorry, but Photoshop is better) and printer drivers – linux still can’t run my Canon Pixma pro 9000 color printer. That and every corporation I do work for has some required program or access method that seems to insist on only running on windows.
That said, while all operating systems suck to some degree, Windows consistently manages to suck more than most. Cygwin supplements Windows pathetic command line with a bash shell and a lot of UNIX functionality.
When you run adobe batch scripting to resize a series of jpg’s and then save them in a different directory as gif files, it insists on writing “copy” in the file name. photograph1.jpg becomes “photograph1 copy.gif”. To remove the ” copy” string, run:
$ for i in *
> do
> mv "$i" "${i/\ copy.gif}".gif
> done
sed and awk
One of the instructors I had in UNIX system administration courses was… How to put this… One brick short of a wall. He was supposed to include sed and awk UNIX commands i the course, and he glossed over them as “something you would never use, trust me”. A couple of years later, when I needed and had to learn the commands, I thoroughly realized he was very wrong.
I had to rename a series of website pages in a site redesign – including altering the names inside the pages themselves. Here’s how I did it.
Here’s the command that changed one set of links from the old page to the new:
for i in ` grep photographs_5.html * | awk -F : '{ print $1 }'`
do
echo $i
sed 's/photographs_5.html/photographs_001.html/g' < $i > $i.1
mv ${i}.1 ${i}
done
This loops through and finds any files with the string “photographs_5.html”
echos out each file, changes (using the sed command, standard UNIX tool…) from photographs_5.html to photographs_001.html, creating a new file named [file].1,
then replacing the original file by moving (mv) the [file].1 file over on top of the [file].
I love UNIX. Both of these were done on Windows using the bash shell in cygwin. This supplies basic UNIX functionality to Windows, including the bash shell, sed and awk, ssh and rsync (by selecting the package), wget and gpg (extra package selection), and many other functions. The setup program downloads a list, within which you can select additional packages, download and install.
Cygwin at least makes Windows somewhat command line friendly.
—dsm
recent posts
- home to Boston, daughter in remission
- visually healthy bone marrow…
- matter of the lungs
- Fall through code to a success…
- another tool for SVN – list_repositories.pl
- svnadmin.pl – perl cgi script to manage svn over apache
- testing Crosspress (plugin)…
- subversion compile and install as non-privileged user…
What I'm Doing...
- flying back to Boston tomorrow, and watching my daughter come off a ventilator and breathe on her own... 1 week ago
- writing a startup and shutdown sc ript for all of jboss-land 2009-08-25
- finished and deployed svnadmin.pl cgi, documented it and checked into subversion... next is more log4j edits, and deploy jsvn (java svn) 2009-05-08
- More updates...
Posting tweet...


