Midnight Commander - ArchWiki

# Midnight Commander

Related articles

- File manager functionality
- ranger

Midnight Commander is a visual file manager, that allows to copy, move and delete files and whole directory trees, search for files and run commands in the subshell. It includes an internal viewer and editor.

As it is based on versatile text interfaces, such as Ncurses or S-Lang, it works on a regular console, inside an X Window terminal, over SSH connections and all kinds of remote shells.

## Installation

Install mc from the official repositories. The development version is available in the AUR as mc-git.

### Additional themes

- mc-solarized-git — Solarized color scheme for Midnight Commander

  https://github.com/nkulikov/mc-solarized-skin || mc-solarized-git

- mc-skin-candy — Candy color scheme (256color)

  https://github.com/izmntuk/archiso/blob/master/configs/alter/root-image/usr/share/mc/skins/candy.ini || not packaged? search in AUR

## Tips and tricks

### Change keybindings

Create a user copy of the default keybinds:

    cp /etc/mc/mc.keymap ~/.config/mc/

and edit to preference. Other keymaps are also available, for example, you can explicitly set to use the `/etc/mc/mc.emacs.keymap` with the `MC_KEYMAP` environment variable:

    export MC_KEYMAP=/etc/mc/mc.emacs.keymap

See Redefine hotkey bindings in `man 1 mc` for details.

### Enable Lynx-like motion

To browse folders using the cursor keys, go to Options (`F9`, `o`) → Panel Options (`p`), set Lynx-like motion checkbox in Navigation group (`y`) and press OK (`o`).

### Start from the menu

Midnight commander can be run from a menu with the correct Desktop entry. For example:

    [Desktop Entry]
    Type=Application
    Version=1.0
    Name=Midnight Commander
    Comment=Visual file manager
    Exec=mc
    Icon=folder
    MimeType=inode/directory
    Terminal=true
    Categories=Utility;

### Trash support

Midnight Commander does not support a trash can by default.

#### Using libtrash

Install libtrash from the AUR, and create an mc alias in the initialization file of your shell (e.g., `~/.bashrc` or `~/.zshrc`):

    alias mc='LD_PRELOAD=/usr/lib/libtrash.so.3.3 mc'

To apply the changes, reopen your shell session or `source` the shell initialization file.

Default settings are defined in `/etc/libtrash.conf.sys`. You can overwrite these settings per-user in `~/.libtrash`, for example:

    TRASH_CAN = .Trash
    INTERCEPT_RENAME = NO
    IGNORE_EXTENSIONS= o;exe;com

Now files deleted by Midnight Commander (launched with mc) will be moved to the `~/.Trash` directory.

Warning:

- Applications launched from mc inherit `LD_PRELOAD`, which may cause problems with some applications. [1]
- With `GLOBAL_PROTECTION = YES` set (default), files deleted outside the home directory are moved to the trash, even if they are on a different partition. Depending on the file, this may cause a significant delay.

See also [2].

## Troubleshooting

### Exit to the current directory

On exit, the shell returns to the directory Midnight Commander was started from instead of the last selected directory. A simple workaround is to hide the interface (instead of quit) with `Ctrl+o`.

### Garbled screen

Press `Ctrl+l` to redraw the display. This only redraws, but does not refresh (`Ctrl+r`) the file list.

## See also

- An Introduction to the Midnight Commander
- GNU Midnight Commander User's Guide
- Midnight Commander Guide
- MC Tutorial
- Cheatsheet for Midnight Commander

Category:

- File managers