SPOT  Spot's Perspective On Technology
Colorful talk in black and white shades of grey.

site map

GNU Midnight Commander

2004-12-09 20:01:41

a Power User's Swiss Army Knife

A GNU/Linux system is built in layers, and much debate can be found arguing the relative merits of the GUI interface and the underlying command line interface. Although one can hide the presence of the command line, it always exists underneath at some level, and ignoring its power will deprive one of certain benefits. On the other hand, the command line can be intimidating, and if you need its power, a little help is usually much appreciated. This is the space in which mc, the GNU Midnight Commander, shines. It bridges the gap between the ease of use of the GUI interface and the raw power of the command line, giving one convenient and guided access to the file system for any need, be it emergency repairs or just exploration.

mc - a brief introduction

mc screenshot Midnight Commander is launched with the mc command. By default, mc launches in a two pane file list mode. You can navigate between panes with the TAB key, and within a pane with the cursor up and down keys. A highlighted file can be copied or moved to the other pane's directory, deleted, viewed or edited with a touch of the function keys as shown at the bottom of the window. The editor is so simple to operate, it needs almost no instruction, but at the same time it offers features such as syntax highlighting. The pull down menus offer even more power, like chown and chmod commands, link and symlink creation and more, plus many more display options. If the terminal environment supports mouse input, many of mc's features can be controlled with the mouse, although all features are available via the keyboard. There is always a command shell available in the lower area of the screen, and can be used for quick navigation or any other purpose. A %f sequence typed in this command shell will be replaced with the highlighted filename. In addition to regular files, mc supports a number of virtual filesystems, such as working within tar.gz archives or through ftp or shell connections. There are even features to allow exploring the contents of RPM packages, even on non-rpm based systems. Default handling for any file type can be customized. Add to this the fact that mc will work without a functioning GUI environment, such as XFree86, and is quite at home over telnet or ssh style connections and you will find that this is an excellent tool for a wide variety of system administration tasks, for both routine and emergency uses.

Installation and Troubleshooting

Midnight Commander is included in most Linux distributions, so check your distro's normal mechanisms first. The source code, as well as some precompiled binaries are available at the home page on ibiblio.org. There is extensive help text included in the program, as well as the venerable man pages. One common issue is corrupted line drawing characters, and the work around is to add a -a option (i.e. mc -a) when launching. Corrupted display colors can be overridden with the -b option to force black and white mode, while the -c option forces color mode. If the function keys are not available, as can be the case when some other program is capturing the keystrokes, or when the terminal is not correctly identified, you can usually hit the Esc key followed by a number key to have the same effect, for example Esc-1 should bring up help, and Esc-0 should bring up the quit dialog.

Good luck, and be careful with all that power!

Article 26 was last updated 2004-12-09 20:11:44

Find GUI simplicity with command line power with Midnight Commander.