MC – nostalgic panels view on any server

Midnight Commander is a free cross-platform orthodox file manager. It was coded by Miguel de Icaza in 1994 in a style of the then-popular Norton Commander, DOS Navigator, and other panel file managers.

MC app has aligned long-lasting discussion between GUI-based file managers versus the traditional command line tools for file manipulation such as cp, mv, and rm. While many common file manipulations are easily done with a graphical file manager, the command line tools provide additional power and flexibility.

In this adventure we will look at Midnight Commander, a character-based directory browser and file manager that bridges the two worlds of the familiar graphical file manager and the common command line tools.

The design of Midnight Commander is based on a common concept in file managers: dual directory panes where the listings of two directories are shown at the same time.

Either can list directory contents, show a plain text preview, file details, or a directory tree (see Directory Tree). File operations are accessible through the function keys or the mouse. More options are visible in a dynamic user menu (F2) and option menu (F9). Keys above F12 (F13 up to F20) are accessible through Shift. Menu and dialog options have one letter highlighted – pressing this letter (or Alt+Letter inside a text entry) directly activates the respective option.

Midnight Commander main idea

The idea is that files are moved or copied from the directory shown in one pane to the directory shown in the other. Midnight Commander can do this, and much, much more.

Features

Midnight Commander is quite powerful and boasts an extensive set of features:

  • Performs all the common file and directory manipulations such as copying, moving, renaming, linking, and deleting.

  • Allows manipulation of file and directory permissions.

  • Can treat remote systems (via FTP or SSH) as though they were local directories.

  • Can treat archive files (like .tar and .zip) as though they were local directories.

  • Allows creation of a user-defined “hotlist” of frequently used directories.

  • Can search for files based on file name or file contents, and treat the search results like a directory.

Midnight Commander screen layout:

  1. Left and Right Directory Panels

    The center portion of the screen is dominated by two large directory panels. One of the two panels (called the current panel) is active at any one time. To change which panel is the current panel, press the Tab key.

  2. Function Key Labels

    The bottom line on the display contains function key (F1-F10) shortcuts to the most commonly used functions.

  3. Menu Bar

    The top line of the display contains a set of pull-down menus. These can be activated by pressing the F9 key.

  4. Command Line

    Just above the function key labels there is a shell prompt. Commands can be entered in the usual manner. One especially useful command is cd followed by a directory pathname. This will change the directory shown in the current directory panel.

  5. Mini-Status Line

    At the very bottom of the directory panel and above the command line is the mini-status line. This area is used to display supplemental information about the currently selected item such as the targets of symbolic links.

File manager overview

Being a character-based application with a lot of features means Midnight Commander has a lot of keyboard commands, some of which it shares with other applications; others are unique. This makes Midnight Commander a bit challenging to learn. Fortunately, Midnight Commander also supports mouse input on most terminal emulators (and on the console if the gpm package is installed), so it’s easy to pick up the basics. Learning the keyboard commands is needed to take full advantage of the program’s features, however.

Another issue when using the keyboard with Midnight Commander is interference from the window manager and the terminal emulator itself. Many of the function keys and Alt-key combinations that Midnight Commander uses are intercepted for other purposes by the terminal and window manager.

To work around this problem, Midnight Commander allows the Esc key to function as a Meta-key. In cases where a function key or Alt-key combination is not available due to interference from outside programs, use the Esc key instead. For example, to input the F1 key, press and release the Esc key followed by the “1” key (use “0” for F10). The same method works with troublesome Alt-key combinations. For example, to enter Alt-t, press and release the Esc key followed by the “t” key. To close dialog boxes in Midnight Commander, press the Esc key twice.

Before we start performing file operations, it’s important to learn how to use the directory panels and navigate the file system.

As we can see, there are two directory panels, the left panel and the right panel. At any one time, one of the panels is active and is called the current panel. The other panel is conveniently called the other panel in the Midnight Commander documentation.

The current panel can be identified by the highlighted bar in the directory listing, which can be moved up and down with the arrow keys, PgUp, PgDn, etc. Any file or directory which is highlighted is said to be selected.

Select a directory and press Enter. The current directory panel will change to the selected directory. Highlighting the topmost item in the listing selects the parent directory. It is also possible to change directories directly on the command line below the directory panels. To do so, simply enter cd followed by a path name as usual.

Pressing the Tab key switches the current panel.

Midnight Commander shortcuts

Action Default shortcut Description
Up Up, C-p move the selection bar to the previous entry in the panel
Down Down, C-n move the selection bar to the next entry in the panel
Left Left move the selection bar to the left
Right Right move the selection bar to the right
PageUp PgUp, Alt-v move the selection bar one page up
PageDown PgDn, Alt-p move the selection bar one page down
Top Home, a1, Alt-< move the selection bar to the first entry in the panel
Bottom End, c1, Alt-> move the selection bar to the last entry in the panel
TopOnScreen Alt-g move the selection bar to the first visible entry in the panel
MiddleOnScreen Alt-r move the selection bar to the middle visible entry in the panel
BottomOnScreen Alt-j move the selection bar to the last visible entry in the panel
CopySingle Shift-F5, F15
MoveSingle Shift-F6, F16
DeleteSingle Shift-F8, F18
Search Ctrl-s, Alt-s start a quick filename search in the directory listing
SelectCodepage Alt-e change charset of current panel
History Alt-H show the directory history
HistoryNext Alt-u move to the next directory in the history
HistoryPrev Alt-y move to the previous directory in the history
EditNew Shift-F4, F14
ViewRaw Shift-F3, F13
Select + (‘plus’ key) select (tag) a group of files
Unselect \ (‘backslash’ key) unselect a group of files
SelectInvert Alt-* invert selection on the current panel
PanelOtherSync Alt-i make the current directory of the current panel also the current directory of the other panel
PanelOtherCd Alt-o If the currently selected file is a directory, load that directory on the other panel and moves the selection to the next file.
If the currently selected file is not a directory, load the parent directory on the other panel and moves the selection to the next file
PanelOtherCdLink Alt-l If the currently selected file is a link to the directory, load that directory on the other panel and moves the selection to the next file
CdChild Ctrl-PgDn move to the child directory
CdParent Ctrl-PgUp move to the parent directory
CdParentSmart move to the parent directory only if command line is empty, else erase the previous character in the command line
Mark Ins, Ctrl-t tag or untag files. To untag files, just retag a tagged file
MarkDown Shift-Down tag file and move the selection bar to the next entry
MarkUp Shift-Up tag file and move the selection bar to the previous entry
Enter Enter
Sort
SortReverse
SortPrev
SortNext
SortByName
SortByExt
SortBySize
ScrollLeft scroll long file names in panel to the left
ScrollRight scroll long file names in panel to the right

Looking for a custom solution?

Our technicians can provide you with the best custom made solutions on the market, no matter whether you're a small business or large enterprise.

Get in touch