Where to start First steps track · 15 stages
Linux Labs

mc — a terminal file manager

4 min Linux · mc

A two-panel file manager for the terminal: navigation, copying, an editor, SFTP.

Cheat sheet

4 commands Printable version
  • Tab — switch panel F5 — copy F9 — menu
  • Enter — open/run F6 — move F10 — quit
  • Insert — select F7 — new directory Ctrl+O — terminal/panels
  • F3 view · F4 edit F8 — delete Ctrl+R — refresh

Overview

Midnight Commander (mc) is a two-panel terminal file manager (similar to Norton/Total Commander). It's beginner-friendly: two folders are visible at once, files are copied/moved with F-keys, and it has a built-in editor and viewer.

Not always installed — install it as a package (see apt):

bash
sudo apt install mc        # Debian/Ubuntu
mc                         # launch it

Quit with F10 (or q). The bottom of the screen always shows the F-key hints.

Options

7

mc's command-line options control how it starts — the display mode and which file to open right away — not what happens inside the program (that's the F-keys, see the cheat sheet). -a helps when panel borders turn into garbage due to missing UTF-8/font support. -e/-v open a file directly in the editor or viewer, without going through the panels.

Option What it does Example
-e --edit file Open the file directly in the built-in editor (mcedit). mc -e file.conf
-v --view file Open the file directly in the built-in viewer (mcview). mc -v huge.log
-a Draw panel frames with plain ASCII — when UTF-8/line-drawing glyphs break. mc -a
-b Force black-and-white mode, no color. mc -b
-c Force color mode on. mc -c
-u Disable the built-in subshell (Ctrl+O). mc -u
-P --printwd file On exit, print the current directory to the given file — used to change the shell's directory. mc -P /tmp/lastdir

Nothing found. Try a shorter query.

Recipes

3

Navigation

  • Tab — switch between the left and right panel.
  • Arrows / Enter — move around and enter a directory; .. at the top goes up one level.
  • Insert (or Ctrl+T) — select multiple files.
  • Alt+Shift+? / Alt+? — find a file.
  • Ctrl+\ — a list of "hotlist" directories; Ctrl+O hides the panels to show a plain terminal (the shell works there), Ctrl+O again brings the panels back.
  • Ctrl+R — refresh the panel (after changes on disk).

The top menu is F9 (settings, sorting, permissions, panel mode).

F-keys

Key Action
F3 view a file (mcview)
F4 edit it (mcedit)
F5 copy the selection to the other panel
F6 move / rename
F7 create a directory
F8 delete
F9 the top menu
F10 quit

Copying "like a file explorer": put the cursor on the file in one panel, open the target folder in the other one (Tab), press F5.

Editor and SFTP

bash
mcedit file.conf           # the built-in editor on its own (F4 inside mc)
mcview huge.log            # the built-in viewer on its own (F3 inside mc)

Access a remote machine right from a panel (an SSH shell link): menu F9 → Left/Right → Shell link, with a path like:

sh://user@host:/var/www      # the panel shows the remote machine's files over SSH

This lets you copy files between the local and remote panel with F5 — over SFTP/SSH (see ssh-client).

Troubleshooting

4

mc: command not found

It's not installed: sudo apt install mc.

Garbled panel borders

The terminal isn't UTF-8, or the font is missing the glyphs. Run mc -a (ASCII borders), or set a UTF-8 locale (see locale).

Ctrl+O does nothing / the shell is empty

Ctrl+O shows the subshell. Over an SSH session without a full TTY the subshell may be unavailable — quit (F10) and work in a plain shell.

The mouse selects text instead of the panels

Hold Shift while selecting with the mouse — that hands the selection to the terminal instead of mc.

See also

  • files-basics — Navigation and files — ls, cd, cp, mv, rm, cat, less, head, tail, copy-paste in the terminal.
  • cd — Moving around the filesystem: cd, cd -, cd ~, cd .., pushd/popd, CDPATH.
  • ssh-client — Connecting over SSH, copying with scp/rsync, ~/.ssh/config, port forwarding.
Loading…