twitter
    Find out what I'm doing, Follow Me :)

Sunday, August 28, 2011

How Can I Make the Windows Command Prompt Better?

The Windows Command Prompt certainly isn't the most friendly terminal around, and if you're coming from a UNIX background, it can feel like moving from a Ferrari to Fred Flintstone's car. Luckily, with a few tweaks, you can make the Command Prompt just as user-friendly as any other Terminal. Here's how to do it.

Step One: Install Cygwin for a More UNIX-Like Shell

You've probably heard us mention Cygwin before, and we really can't recommend it enough. It takes the crappy Windows Command Prompt and turns it into the useful UNIX terminal Mac and Linux fans are used to. All the commands you remember from your UNIX days will work in Cygwin beautifully, and you can use UNIX-based scripts and programs (like our very own Gina Trapani's Todo.sh) just like you can on Linux or OS X. We've gone through a more detailed guide to Cygwin before, so I won't get too deep into it here. I'll just tell you that your number one job should be installing it, as it'll make your life so much better.

Step Two: Install an Alternate Terminal Program to Make Cygwin Even Better

Cygwin isn't actually a separate program, as it might appear to be. Instead, its a shell that loads in the regular Command Prompt program. Thus it solves half the problem of the Command Prompt—not having any of the same commands or syntax—but it doesn't actually solve the other problems inherent to the program itself. If you want better text selection, better copy and paste, window transparency, and other useful features, you'll want a new Terminal program entirely.
How Can I Make the Windows Command Prompt Better?

I'm a big fan of previously mentioned Console myself, though many prefer previously mentioned Mintty. Both serve similar purposes: they make your terminal act a bit more like the Mac or Linux terminals you're used to, by bringing better copy and paste, text editor-like text selection, and more to your terminal. I prefer Console mainly because it supports tabs, where Mintty does not. However, if you don't require tabs in your terminal, you might want to give Mintty a shot.
If you're using Mintty, the best way to install it is through the Cygwin installer. Run the Cygwin installer again and check it off under "Shells" in the "Select Pacakges" screen. Then, you can access it from the Cygwin folder in your Start Menu.

Step Three: Set Up Your Defaults



Mintty should be ready to go out of the box, but if you're using Console, you've got one extra step before you can get on tweaking your terminal. By default, Console will start up the regular old Windows command line, which is not what we want. To change this, start up Console and go to Edit > Settings. Under "Shell", type C:\cygwin\Cygwin.bat. That will make Console use Cygwin as your default shell when you start it up, so you don't have to worry about starting it up manually each time.


Obviously, if you want the Windows command line, you can still use the original Command Prompt application. Alternatively, if you head to the "Tabs" section of Console's preferences, you can add a new tab under Tab Name, call it "Windows CMD" (or whatever you want), and set the shell to %windir%\system32\cmd.exe. You can also change the startup directory to your User folder (e.g. C:\Users\Whitson), since console will use its program folder by default. Now, when you open a new tab, you can choose to either open a Cygwin tab or a Windows Command Prompt tab, which is pretty convenient—especially because then you'll get all of Console's copy/paste and text selection benefits in the Windows Command Prompt, too.

Step Four: Get Ta-weaking

How Can I Make the Windows Command Prompt Better?
Lastly, you can go nuts configuring your new terminal to your liking. The first thing I did was head into Appearance (or "Looks" on Mintty) and get rid of the absurdly bolt fonts, since all it did was take up space. I also like to make my Terminal somewhat transparent, so I can see the window behind it, since the window behind it is often is a list of commands I need to run (and then I don't need to constantly switch between windows). You can even make it copy text as soon as you select it, which is under Console's Behavior tab and Mintty's Mouse tab. Dig around in the settings and see if there's anything else you want to change. There's a lot of handy stuff in there, and it'll make your life a heck of a lot easier when it comes time to do some command line work.

No comments:

Post a Comment