If you've used an *nix system, at some point you've stumbled upon Midnight Commander, a file manager based on the venerable Norton Commander. You're probably familiar with the basic operations (F5 for copying, F6 for moving, F8 for deleting, etc.) and how to switch panels (ummm, the Tab key). But mc offers so much more than that. This article aims to show all the useful (YMMV) shortcuts and functionalities that are often overlooked. Most of them can be accessed using the menu (F9), but who has the time to do that?

Before we get started, let's establish some facts. This article was written and tested on the following software:

Oh, and make sure you're running a modern and UTF-8 friendly terminal - for example, rxvt-unicode.

Hold your horses

There's actually one thing I'd recommend doing before you run mc. mc has the ability to exit to its current directory. Meaning, you can navigate the filesystem using mc (sometimes it's easier than cping into that one directory buried deep down somewhere) and when you quit mc (F10), your shell will automagically cd to that directory. This is done thanks to the mc-wrapper script that should be bundled with your installation of mc. The exact location is dependent on your distribution - in mine (Gentoo) it's /usr/libexec/mc/, in Ubuntu supposedly it's in /usr/share/mc/bin/. Once found, modify your ~/.bashrc:

alias mc='. /usr/libexec/mc/mc-wrapper.sh'

Restart your shell, launch mc, change to another directory, exit and your shell should be set to that new directory.

Selecting files Accessing the shell Internal viewer (F3) and editor (F4) Panels Searching files Common actions Virtual File System (VFS)

mc has a concept known as Virtual File System. Try "entering" an archive (*.tar.gz, *.rpm or even *.jar) - you'll be able to browse the contents of the archive like a normal folder, without unpacking it first. You extract selected files from the archive by just copying them to the other panel. Bonus points: try "entering" a… *.patch file.

This concept is even more powerful when you realize that remote locations can be viewed the same way. A quick way to browse an FTP location is to just cd to it: cd ftp://mirrors.tera-byte.com/pub/gentoo (first Gentoo FTP mirror I found). You'll be able to interact with files as you normally do. To exit this remote location, cd to a local directory. Just typing cd will suffice as it will take you to your home directory.

VFS works for SFTP and Samba shares too. Check the manpages for more information on how to specify user/pass, etc.

Useful options Bonus assignments

Well, that was a lot to take in. Of course, this list is not complete (that's what man mc is there for), but I've selected the commands and functionalities that are the most useful to me. Embrace the ones you find useful, forget the rest and learn about the other ones I've missed!