Archive for the ‘Command line’ Category

Windows XP PowerToys: Open Command Window Here

Monday, October 29th, 2007

I discussed previously how to add an entry to the Windows context menu that would allow you to open a Cygwin bash shell with the current working directory set to the directory you clicked on. Someone commented on that entry that they have a similar entry for the Windows command prompt. I do as well (although it sees very little use compared to the Cygwin entry) and for those who work in Windows this is something of which they should be aware.

The tools is creatively titled “Open Command Window Here” and is one of the PowerToys for Windows XP from Microsoft. There are a lot of neat little tools in the PowerToys which probably should have been part of Windows XP from the beginning (in particular Tweak UI). If you’re working in Windows check out the PowerToys as they can make your life a little simpler.

Cygwin: Bash Prompt Here

Wednesday, October 24th, 2007

As I’ve already discussed it is quite easy to get yourself a nice little shell called Cygwin on Windows. Once you start using Cygwin it can be quite addictive, I can’t work on Windows without it. The biggest problem is that to get to any of your data outside of the home directory under Cygwin requires navigating through the sometimes unintuitive directory structure under Windows. Typically what happens is you locate the folder with the stuff you want to work on using the Windows explorer and then work your way to it again using Cygwin. This is a somewhat less than efficient use of your time.

Luckily Cygwin comes equipped with a little utility to help you out with this problem. It is called chere and make sure you install it when you install Cygwin. chere installs an entry in the context menu when you right click on directories named “Bash Prompt Here.” Selecting it will open a Cygwin shell with the current working directory set to the directory you right clicked on. To install it simply run this from Cygwin:

chere -i

For more information on chere run this from Cygwin:

man chere

Speed Up Your Compilation Times Part Three: Using distcc

Monday, October 22nd, 2007

This is one of those projects that is just so damn cool that even if you don’t use it you should still know about it. Have a bunch of machines around you? Want faster compile times? Use distcc. As you might gather from the name, distcc allows you to do distributed builds using gcc.

Essentially you install and start distcc on each machine, tell distcc on the main machine which machines to use, and run your build with distcc. The magic that is distcc takes care of the rest. I know it sounds too simple for something that seems so complicated but that’s the beauty of distcc: it really is that simple. Now go, and build things quickly.

Speed Up Your Compilation Times Part Two: Using ccache

Monday, October 22nd, 2007

In my last post I presented a technique for speeding up compilation times in a very limited number of a cases. The obvious question is then what about the rest of the time? Enter ccache. ccache is a compiler cache which is to say that if you request it to compile a file with the exact same preprocessor directives and compiler flags then the result from the cache will be used. I use this tool everyday and I highly recommend it.

For the nervous among you who are worried that ccache will produce results inconsistent with those from just using the compiler, I present this choice quote from the ccache site:

“The most important aspect of a compiler cache is to always produce exactly the same output that the real compiler would produce.”

If my recommendation and the assurances of the ccache site aren’t enough to convince you, I suggest you test it for yourself. I am positive you’ll find it works as advertised and that the decrease in compilation times will convince you to continue to use it.


Wednesday, October 17th, 2007

I often get asked by others how to get started with Linux and the command line when coming from a Windows background. This is typically because I am constantly telling developers they would be more effective if they did so. While this commonly happens, I still struggle to answer this question. Linux is not something I can easily recommend to someone with only Windows experience. Certainly, live CDs like Knoppix and distros like Ubuntu are slowly changing that but I still feel uncomfortable recommending jumping right into Linux. I simply do not want to be responsible for setting someone up for a bad experience with Linux.

That brings us to the point of this post: Cygwin. From the site: “Cygwin is a Linux-like environment for Windows.” Think of it as a way to get your feet wet with Linux without leaving your comfortable Windows. Training wheels, if you will. It will introduce you to most of the tools you’ll find at the command line under Linux and allow you to give them a test drive risk free. If you’re a developer who has only ever worked with tools on Windows, I can not fully express how much Cygwin can change your life and work for the better. I will openly admit that it will be work to become proficient at the command line but the productivity gains are definitely worth it.