Midnight Commander: A File Manager For The Terminal [Linux]

For Linux users, knowing how to get around on the command line is an essential skill. But there are times where you might not remember a particular flag or you actually need to edit a file instead of just working with it. The Midnight Commander is an excellent tool when you need to get thing done quickly.

Midnight Commander is an application modeled after the Norton Commander for DOS and runs inside a terminal. It can use text-mode GUIs such as ncurses, giving them some of the advantages of a full GUI program, but running light on resources and over remote connections like SSH. This makes it extremely handy for server administration, as well as a tool to help rescue systems that won’t bring up a desktop like KDE or Unity.

Ubuntu users can install Midnight Commander from the standard repositories with the following command:

sudo apt-get install mc

Once installed, you can launch Midnight Commander with the following at a terminal prompt:

mc

File Management

Primarily a file manager, Midnight Commander will start up with two panes open, as shown in the figure below.

midnight-commander-twinpanes

Using the Up and Down keys will move the cursor around the directory listing, while Enter will descend down into a directory. Escape will go back up one level. The Tab key will move the focus between the two panels. Using these, you can navigate to anywhere within your current system in a particular panel.

In order to do some file management, get to the files you want to move or copy in one panel, and the location to which you want to move/copy them in another. The bottom of the screen displays the hotkey combinations: F5 is to copy files, and F6 is to move or rename them. Pressing one of these keys will display a dialog confirming your action. You can move focus between fields and buttons in a dialog or by using the Tab key, and use the Space bar to press a button. Using these functions alone, you can do some emergency file management to copy or delete things that are hanging up your system.

There are a number of other file-related tools available from the menu bar (yes, this text-mode program has a menu bar, and you can access it with F9):

  • The “File” menu contains actions to be performed on the files or directories in the currently-highlighted panel. Additional functions include creating links (hard and sym-) and changing permissions (chown) or mode (chmod).
  • The “Left” and “Right” menus allow configuration of how that panel should display, as well as enabling access to remote connections (shell or FTP).
  • The “Options” menu contains overall configuration for Midnight Commander.

Text Editor

I’m sure that for those who spend their days tweaking config files or hacking kernel code, emacs or vim are the greatest thing since sliced bread. As an average user, I find them to be really annoying. When I need to make a quick edit to a file, I’ll often rely on the “mcedit” tool that comes built into Midnight Commander.

midnight-commander-mcedit

“mcedit” provides a text-mode program with many of the visual niceties of a GUI program. Hotkeys are listed at the bottom (F3 to begin marking a selection, then the Copy/Move key once to indicate that’s what you want to do, then moving to the place you want to do it, then a final push of the Copy/Move key takes some getting used to), while the pull-down menus are available with the trusty F9 key.

midnight-commander-mcedit-menus

The Midnight Commander offers a nice collection of tools, suitable for installation on a low-power or server machine, but with many of the visual conveniences of “full” GUI applications. It’s a small download, so go ahead and install it… someday you’ll be glad you did.