Midnight Commander (Version 4.6.1)



Documentation
Features
Usage
Overview
Mouse Support
Keys
Mini-documentation

The GNU Midnight Commander mc is a visual shell much like a file manager, only with many more features. It is a text mode application, but it also includes mouse support if you are running GPM. Midnight Commander's best features are its ability to FTP, view tar and zip files, and to poke into RPMs for specific files.

Documentation

Features

GNU Midnight Commander was conceived as a free clone of John Socha's Norton Commander (TM). It also takes the best from more recent software with similar interfaces. GNU Midnight Commander comes with mouse support on xterm and optionally on the Linux console.

The Commander's current features include:

  • Built in Virtual File System: manipulate remote file systems through the FTP and SMB protocols or over secure shell, browse contents of tar, ar, rpm, zip, cpio, lha and rar archives just like local files.
  • Almost all operations work with the virtual file system, enabling you to do complex tasks, like viewing files in archives on an FTP server.
  • Mouse support on most terminal emulators for X Window System as well as on the Linux console.
  • Learn Keys: GNU Midnight Commander may be configured at run time to support any kind of input keys for a given terminal, making its operation possible even on most weird terminals.
  • Text and hex editors are available for you to use (hex editor is a part of the viewer).
  • Hotlist allows you to keep a list of common visited locations, including remote sites and directories inside archives.
  • Command completion: By pressing Alt-Tab in any place where a filename or an executable are expected, GNU Midnight Commander will complete the name for you. If you press Alt-Tab for the second time, you get a list box with all possible completions.
  • Subshell support: Run your commands by a real shell interpreter. GNU Midnight Commander interacts with bash, tcsh and zsh to provide you with all of the facilities available in your preferred shell.
  • Find file command can search for the file contents.
  • Background operations allow you to copy or move files from any virtual file system while you do other tasks (i.e., you can do background FTP copies).
  • FTP proxy is supported.
  • Linux file recovery: If you are using Linux, you can recover deleted files from an ext2 or ext3 partition with the undelete file system. This is a low level file recovery function that can recover files deleted by any program on Linux.
  • External panelization: You can run any arbitrary external command and GNU Midnight Commander will display the output generated as a file listing that can be manipulated as a regular directory.
  • Emacs-like key bindings are used in all widgets.
  • Context dependent actions (open, view, edit) are available.
  • The built-in file viewer, together with the context dependent actions is used to format man pages on the fly, coloring mail messages and more.
  • The built-in editor supports syntax highlighting and external actions, such as spell checking and formatting.

Usage

Start the Midnight Commander by typing

$ mc

at the prompt of an xterm (see Mouse support on why you should use an xterm).

Overview

The screen of the Midnight Commander is divided into four parts. Almost all of the screen space is taken up by two directory panels. By default, the second bottommost line of the screen is the shell command line, and the bottom line shows the function key labels. The topmost line is the menu bar line. The menu bar line may not be visible, but appears if you click the topmost line with the mouse or press the F9 key.

The Midnight Commander provides a view of two directories at the same time. One of the panels is the current panel (a selection bar is in the current panel). Almost all operations take place on the current panel. Some file operations like Rename and Copy by default use the directory of the unselected panel as a destination (don't worry, they always ask you for confirmation first). For more information, see the sections on the Directory Panels, the Left and Right Menus and the File Menu.

You can execute system commands from the Midnight Commander by simply typing them. Everything you type will appear on the shell command line, and when you press Enter the Midnight Commander will execute the command line you typed; read the Shell Command Line and Input Line Keys sections to learn more about the command line.

Mouse Support

The Midnight Commander comes with mouse support. It is activated whenever you are running on an xterm(1) terminal (it even works if you take a telnet or rlogin connection to another machine from the xterm) or if you are running on a Linux console and have the gpm mouse server running.

When you left click on a file in the directory panels, that file is selected; if you click with the right button, the file is marked (or unmarked, depending on the previous state).

Double-clicking on a file will try to execute the command if it is an executable program; and if the extension file has a program specified for the file's extension, the specified program is executed.

Also, it is possible to execute the commands assigned to the function key labels by clicking on them.

If a mouse button is clicked on the top frame line of the directory panel, it is scrolled one pageful backward. Correspondingly, a click on the bottom frame line will cause a scroll of one pageful forward. This frame line method works also in the Help Viewer and the Directory Tree.

The default auto repeat rate for the mouse buttons is 400 milliseconds. This may be changed to other values by editing the ~/.mc/ini file and changing the mouse_repeat_rate parameter.

If you are running the Commander with the mouse support, you can bypass the Commander and get the default mouse behavior (cutting and pasting text) by holding down the Shift key.

Keys

Some commands in the Midnight Commander involve the use of the Control (sometimes labeled CTRL or CTL) and the Meta (sometimes labeled ALT or even Compose) keys. We will use the following abbreviations:

C-<chr>
means hold the Control key while typing the character <chr>. Thus C-f would be: hold the Control key and type f.
M-<chr>
means hold the Meta or Alt key down while typing <chr>. If there is no Meta or Alt key, type ESC, release it, then type the character <chr>.
S-<chr>
means hold the Shift key down while typing <chr>.

All input lines in the Midnight Commander use an approximation to the GNU Emacs editor’s key bindings.

There are many sections which tell about the keys. For more information about keys, see the man page mc(1).

Learn keys

The Learn keys command in the "Options Menu" pops up a dialog from which you test your keys which are not working on some terminals and you may fix them.

You can move around with the Tab key, with the vi moving keys ("h" left, "j" down, "k" up and "l" right). Once you press any cursor movement key and it is recognized, you can use that key as well.

You can test keys just by pressing each of them. When you press a key and it is recog- nized properly, OK should appear next to the name of that key. Once a key is marked OK it starts working as usually, e.g. F1 pressed the first time will just check that the F1 key works, but after that it will show help. The same applies to the arrow keys. The Tab key should be working always.

If some keys do not work properly then you won’t see OK appear after pressing one of these. Then you may want to redefine it. Do it by pressing the button with the name of that key (either by the mouse or by Enter or Space after selecting the button with Tab or arrows). Then a message box will appear asking you to press that key. Do it and wait until the message box disappears. If you want to abort, just press Escape once and wait.

When you finish with all the keys, you can Save them. The definitions for the keys you have redefined will be written into the [terminal:TERM] section of your ~/.mc/ini file (where TERM is the name of your current terminal). The definitions of the keys that were already working properly are not saved.

Mini-documentation

These are hints for the text mode edition:

  • Use the F-Keys for invoking the commands in the function key bar. If your terminal doesn't support F-keys, you can use the <ESC digit> sequence to invoke the corresponding F-digit key.
  • Tab changes the current panel.
  • All input lines have emacs-like key-bindings (command history is accessed through the M-p and M-n keys).
  • The panels accept C-n, C-p for browsing the panel (like in emacs).
  • M-Enter copies the currently selected file name to the input line.
  • M-Tab completes the current word (or tries to).
  • The Virtual File System is a cute addition to the project, you may browse in tar and compressed tar files as well as browsing remote machines with the mcfs file system.
  • Please read the manual page.

You can access the whole documentation online with the F1 key, although it's not as nice as the groff printed manual page.