Cmder: Making the Command Line Your Best Friend

Now that I’ve jumped fully on board the Git and GitHub bandwagon, I’m spending a lot more time at the command line.  In fact, I find myself working with both Visual Studio and the command prompt simultaneously, constantly switching back and forth between the two.  The main reason is that, while Visual Studio 2013 makes a great Git client and tools such as TortoiseGit are a great help, there are some Git commands, like stash and rebase, that either aren’t supported well by the tools or are just easier to perform at the command line.  Besides, most of the online Git tutorials list Git commands.

cmder-main

DOWNLOAD Cmder here: https://github.com/cmderdev/cmder.

Another reason why I find myself more on the command line is that I’m working with ASP.NET 5, which requires the use of a command prompt for managing versions of the runtime and generally embraces command line tools as a first class citizen.  Finally, there’s Chocolatey, for easily installing tools at the command line, and, of course, PowerShell for automating actions with scripts.

As my need to work at the command line has increased, so has my frustration with the standard windows command prompt. Thankfully, I’ve run across a very nice command prompt replacement called Cmder, which combines the console emulator, ConEmu, with cmd enhancements from Clink and Git support from msysgit.  In short, it’s the one command prompt you’ll ever want to use.

If for no other reason, Cmder will win you over with its support for ^C and ^V for Copy and Paste. A list of basic commands can be found here, and you can execute a command to add file explorer integration, so that you can right-click on a directory to see “Cmder Here” in the context menu (open an administrator prompt at the Cmder installation directory and execute .\cmder.exe /REGISTER ALL).

I much prefer using Cmder for all my git command-line tasks rather than opening a Git Bash prompt, because all the standard cmd.exe commands are there, and it shows both the repo location and current branch.  Here you can see I’m at a local Git repo on the master branch, then I list all the branches and checkout the develop branch.

cmder-git

And here you can see an example of executing ASP.NET 5 commands, such as dotnetsdk (aka kvm).

cmder-asp

There are some fancy things you can do with Cmder, including basic unix commands (such as ls, mv, cp, grep, cat) and aliases, which are shortcuts you can define in a text file (located in config\aliases) for common tasks. For example, there’s a built-in alias for the Windows file explorer. Simply type .e, and an explorer window opens at your current location.

Besides its versatility, what I especially like about Cmder is the ConEmu goodness that comes with it.  It’s easy to set up predefined tasks that open additional tabs in the same Cmder window so you can switch between them by pressing Ctrl+Tab and Ctrl+Shift+Tab.  You can also assign each task a hot key. To set up tasks, just click on the dropdown arrow to the right of the green plus icon in the lower right-hand corner.

cmder-setup-tasks

Selecting “Setup tasks…” from the menu will display a dialog for configuring ConEmu settings.  From here you can click “Add default tasks,” then tweak the commands that were inserted.  This will allow you to open new tabs for an administrator prompt, PowerShell, Chocolatey and Git Bash, among others.

cmder-tasks

Another thing you can do at this dialog is to assign a different palette (color scheme) for different commands.  For example, it would be nice for the Admin prompt to show up with a slightly different color scheme to give you a visual queue as to which console you’re on, and it would be just as nice for the PowerShell console to light up with the standard PS colors.  To do that, you can select Features / App distinct, then add application distinct settings which override the default color palette.

cmder-app-distinct

Executing the PowerShell Admin task will, for example, open a new elevated Cmder tab colored in the same way as the standard PS prompt.

cmder-ps

Lastly, after making these customizations you’ll want to export the settings file.  If you want to use the settings file I created for my own use, you can get it here.  Better yet, you can copy the entire cmder folder to a USB stick or a cloud service, such as DropBox, where you can use it from any connected machine.  Enjoy!

About Tony Sneed

Married with three children.
This entry was posted in Technical and tagged , . Bookmark the permalink.

10 Responses to Cmder: Making the Command Line Your Best Friend

  1. bdaniel7 says:

    Hi,
    The link on DropBox seems dead. Can you share the settings file once more?

    Thanks,
    Daniel

  2. bdaniel7 says:

    I only meant the link to the DropBox settings file.

  3. vineeth says:

    Hi Tony,

    Thanks for this informative article on Cmder. I`m facing an issue while using alias for command [ git commit -a -m bla bla ]. The alias i use for above is [ gcm=git commit -a -m “$*” ]. But it looks like my all comments are shown as just a $ symbol. Any idea how to fix this?

    Thanks
    Vineeth

  4. Sarath chandra says:

    i wrote a c program … in bash … but I couldn’t compile it help me! what is the shortcut for compilation? it’s showing me error when I use gcc

  5. puchoweb says:

    Hi Tony,

    Great post.
    Took your suggestion and added file explorer integration for Cmder, so that I can right-click on a directory to see “Cmder Here” in the context menu. But my clipboard manager, “Ditto,” already uses “Ctrl+`” keystroke. Having trouble redefining Cmder minimize/restore window keyboard shortcut however. Cmder is resetting back to “Ctrl+`” after its changed. Any clues?

    Thank you for sharing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s