Commander is a console file manager and directory browser. It is a
friendly system for many tasks in the terminal window, and the quickest
way to copy, move or delete multiple files. MC can also do fast ftp and
network file transfers. Other unique features are the ability to browse
inside archives and undelete files.
Install and launch mc
Check that mc is installed in your
distribution - it is no longer installed by default in some distros,
such as openSUSE, but easy to do with a package manager.
Operations on installing from source.
Midnight Commander by typing mc in a terminal window. The main section
will be the two
directory panels, with a dropdown menu line above, a command line
below that a list of the present functions of the F (function)
keys. Above the command line is a Hint line that shows random
Your mc may also open the F2 file operation menu on
start-up, a little irritating, so cancel this by unticking "Auto Menus'
when configuring Midnight Commander.
To quit mc, use key F10.
Basics: Navigation in the Directory Panels
Generally, you want to
display different directories either side, so you can action files
around mc with the keyboard:
To change up into a
parent directory, arrow up to the top line and enter on /..
(usual parent directory notation). To change
down into a subdirectory, arrow down
- Tab key to change to the opposite directory
- scroll through directories with up/down arrow keys
- Home and End to jump to the top or
bottom of a long directory
- pg-up and pg-down to scroll one screen
at a time
- back/left arrow to change to parent directory
(with lynx-like motion enabled)
See Configuration on
how to enable 'lynx-like motion'. Without needing to scroll to the top,
the back arrrow will change you directly into the parent
'F' (function) keys are widely used in mc for file operations. Read the bar
at the bottom
current function, which may differ according to the context,
eg. browsing a directory, using the file viewer, or the editor.
In normal browsing mode:
F1 - help. More readable than the 2000-line man page, although difficult to browse.
F2 - user menu ( offers option to gzip files, etc.)
F3 - view (handy to check the contents of an rpm or tgz file, or read
contents of files)
F4 - edit with internal editor, mcedit
F5 - copy
F6 - rename or move
F7 - create a directory
F8 - delete
F9 - pull-down - accesses the menu bar at the top.
F10 - quit. Closes mc, as well as mcedit and any unwanted open menu.
If you don't have F keys, use Esc - number sequence (1-0) instead.
F10 key in Gnome Terminal: opens the main terminal File menu instead, so click quit with mouse.
All shortcuts are noted in the menus. In mc's keyboard shortcut notation, 'C-x i' would mean
press Ctrl and x simultaneously, release both then press i. M refers to
the Alt key. A few common shortcuts:
- Switch back and
forth to the console with Ctrl–o while keeping mc running. (also called hiding panels or subshell support.)
- In menus, arrow up or down and Enter, or use
the 'hotkey' -
the highlighted letter in each menu item.
- Toggle tick boxes on or off with the space
- select multiple files with the insert key
- Mac users without an Insert Key: Use Ctrl-t
- Tab key also moves sequentially through
fields of selection boxes
- Ctrl R - refresh or rescan directory view
- Alt-shift ? - find file
- Ctrl-x d - compare directories (release ctrl-x before pressing d)
- Ctrl \ - open directory hotlist
- Ctrl-x c (o,s,l) - chmod, chown, symlink, link
- Alt c - quick cd (opens a box, quicker to type than arrowing through if you know its full path)
- (Shift) + - select group. Can enter wildcards to highlight a certain type or name of file.
- (Shift) * - reverse selection. Changes
highlighting to all unselected files. Handy to use these two in
combination if you are trying to quickly select all but a certain
- \ - unselect group. Opposite of +.
the top is the drop-down menu bar. F9 highlights the Left / Right menu,
then arrow sideways across. (See Configuration to set drop-down menus,
so you will not have to Enter to display that menu.)
To select a menu item, arrow down and Enter,
or use the hotkey - the highlighted letter.
the menus and see what features they offer. A brief overview:
- Left / Right
menus: refer to actions on the respective side panel.
- Sort Order
option allows you to choose how to display directory contents -
by name, size, date and case sensitive/insensitive, etc.
- Listing Mode allows you to change how your
directory is displayed. Brief: shows contents in two columns on that
pane. Full: gives a standard view. Long: shows permissions, ownership
and long file names in full, but removes the other pane to make space.
You can also cycle through these views by using Alt - t.
- In Listing Mode, tick "User Mini Status" which
will handily display the permissions of the presently highlighted file
or directory within the separate line at the bottom of the panel.
- File menu: gives you a
number of options
to link, change ownership and permissions.
- Command menu: has several
- 'Directory Hotlist' to bookmark your favourite
directories, including remote
machines and FTP sites, then quickly access the list with Ctrl-\ .
- 'Undelete files' to recover deleted files
on Linux/Unix. It works on ext2 and ext3 partitions. See Advanced Operations.
- Other useful features are
showing directory sizes and comparing two directories.
for layout, confirmation options, and Configuration to set up your
Select Options menu,
Configuration. To mark or unmark the boxes, use the Space bar or mouse
click. (The top left section, 'Panel Options' is a separate listing in
the main Options drop-down menu in version 4.7.3. Regardless of
location, Panel Options is where to select 'show hidden files' and 'lynx-like motion'.)
much fiddling with the configuration messed up my mc –
and I couldn't restore it as I didn't know what I had done. No problem
– just delete the .mc directory in your home directory, relaunch mc and
reconfigure from scratch. The profile is specific to each user.
Mark 'drop-down menus' - otherwise F9
will only highlight the menu name, and you will still have to enter on
it to display the menu.
Unmark 'show hidden files' unless you want to see them, or they clutter
up your directory. Also untick 'mix all files' and
'fast dir reload'.
In 'Pause after
run', tick 'always' to enable you
to read output or error messages in the terminal after executing a
In the right hand menu 'Other Options' mark all -
except 'auto menus' and
'safe delete'. 'Auto menus' will irritatingly open the F2 menu when
launching mc, and 'safe delete' defaults to No when you press F8, so
it's only if you want to be twice as careful before confirmation.
motion' is one of the handiest options,
and enables you to enter sub- and parent directories with the
forward and back
arrow keys, from wherever you are in the directory. Otherwise you would have
to scroll back up to the top and enter to return.
Remember to save when you are done.
and directories can be moved, copied, deleted and the contents viewed
easily through the F keys - always refer to the options list
underneath. If you are moving or copying files,
it will first assume you are actioning to the opposite directory, giving you the option to change the
the directory panels, select single files simply by arrowing to them, and select multiple files by using Insert
key to highlight – and Insert again on any file to unselect.
You can filter for groups of
files: the + key will bring up a selection box into which you can enter
wildcards. For instance, when I had moved a bunch of cartoon files by
mistake into my Songs directory, I selected *jpg and it automatically
highlighted them all. Then F6, which moved them across to the Cartoons
directory on the other side.
View contents or edit files using the F keys, and Enter
or double-click on file to execute or open it with an external program.
Many of these external programs (Imagemagick, xpdf etc) may not be installed by default in your distro, so the
programs to open images, pdfs and word processor docs etc. can be
edited by the truly confident via Command menu, Edit Extension File.
There are two 'file' menus. The top one - F9 - is for accessing operations such as changing permissions
or ownership, linking and symlinking. The 'file user' menu from the bottom bar - F2 - deals mostly with zipping and extracting files and subdirectories, and
also for opening the man page.
Advanced Directory Operations
- Find files in large directories with mc's search function by using shortcut Alt - ? (Alt+shift ?)
- Compare the contents of two directories by opening
them in panels side by side, then Command menu, Compare directories, or
shortcut Ctrl-x d. This will highlight all files that are different in
the two sides.
- To view or hide hidden (dot) files, enter the
configuration menu under Options and tick or untick.
- The delete function, F8, will
delete non-empty directories, after confirmation. Very handy.
The command line
Although I don't use the command line much in mc, it should
execute whatever you have typed into it. If you wish to su, it will
return you to the terminal to type in your password. Then relaunch mc
as root; if you ctl-o, it will take you back as user.
While anything remains typed into the command line, the sideways arrow
keys move through the text and won't work to
navigate in the panels. If your arrow keys suddenly don't work, check
and clear the command line.
To scroll back and forth through command history, use alt - p for previous and alt - n for next command instead
of the the up and down arrow keys (as in the
terminal window), since mc uses them for navigating.
Using the mouse in mc – For click-click fans
The mouse works
in mc, but the keyboard is handy to know when the battery goes flat in
your cordless mouse... From the man page:
The Midnight Commander comes with mouse support. 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
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
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.
If your mouse does
not work in mc, check that gpm mouse server is installed and running.
Accessing Contents of Archives
sorts of archives - RPM, deb, tgz, iso, rar, cpio etc. are accessible
with mc. The individual files can be viewed and extracted without
needing to unpack or install - even password-protected archives.
Certain types of archive files need other packages installed to look inside: eg. to
access .deb on an rpm-based system, install
package deb which includes dpkg, etc. And to access iso files, I needed package cdrkit-isotools (may be installed by default on your distro, but not on PCLinuxOS).
To see an
overall view, F3 directly onto the file. In
this screen, the F keys have different functions again. To quit
screen, use F10 (or click on quit at the bottom,
if F10 instead activates a menu from your Gnome terminal).
To access the contents, Enter onto the file, then drill down into the
contents, where you can now read the text files with F3 or copy
out individual files. This is very handy for rpms, where you can copy
out a needed
library, for instance, in a package you can't install due to
conflict or dependency issues.
archives can be similarly viewed and files browsed and copied before
unzipping (unzip .zip by command line only - the F2 unzip function only
works with .gz or .bz2 extensions. This may be enabled in future versions).
The F2 file user menu also gives options to tar or
zip files in a directory.
RPM and tgz
RPM: If not already root,
su and relaunch mc. Enter on the rpm and
select install or upgrade. I only figured out how to install them
singly, though, so for multiple rpm's use the command line.
If you have configured mc to always pause after run,
the terminal will show you the output. Otherwise, it flashes back to mc
after running and you won't know you have an error message unless you
ctl–o to check in the
TGZ: To extract a
tarball, F2 for a file user menu,
then x to extract. You can cd to the extracted directory, then
./configure, make and make install from the
command line, as per the INSTALL file instructions (which you read with
F3), although there remains the problem of having
to su to root halfway when you start as user.
files with mcedit
MC's integral editor is easy to use, and even if you're not in mc, you can start it directly from the
command line: mcedit <filename>.
In mc, open a file to edit with F4. Once finished, F2 to save
and F10 to quit (or click quit at the bottom). If it won't save your
file, that means you forgot to edit it as root and now you're going to
have to su and do it all over again! (Remember to relaunch mc once you
Note the F keys have slightly
different uses in the editor - refer to the function bar at the bottom.
Mouse highlighting to copy and
paste works similarly to the terminal,
but use the shift key at the same time: shift, highlight, then shift
and paste with the middle button. Or, paste other items on your
clipboard with Shift-Insert.
A shortcut to jump to the top or bottom of a long file while editing is Ctl-home or Ctl-end.
Using mc to
MC can ftp via the command line, the Left /
Right menu, or to a site you have 'bookmarked' in your directory
To disconnect ftp, type cd in the command line and
will return you to your home directory.
If you access the site regularly, add
it to your directory hotlist for fastest access. Go to Command menu -
Directory Hotlist - add by either typing it in,
or if you are connected in a panel already, simply Add Current. Access the list with
Ctl - \ .
line: For anonymous sites, the format is cd
To connect to a site with a password
(This may return an error message if you
did not specify a directory, but will connect you anyway.)
Or type in the full path: cd
/ Right dropdown menu: will connect on that respective side.
Arrow down to
FTP link, or use hotkey P. A dialog box will request the FTP address in
For all methods, the username alone can be
entered, eg. firstname.lastname@example.org and and
box will request the password. If the command line is used, this is
more secure, as the password may be read in plain language when
scrolling back through the command line history.
if you have @ in the username?
Originally, support for this was missing. Try enclosing the username in
double quotation marks "user@name":email@example.com
If, however, the username itself includes ftp, such
"firstname.lastname@example.org" then mc will not connect. Either use another ftp
client, or this workaround:
- In your home directory, create a .netrc file: touch
.netrc && chmod 600 .netrc
- open it for editing: mcedit .netrc
- add the following line to the file, with your own
details in place of italics:
- machine ftp.yoursite.com login email@example.com password password
- F2 to save and F10 to quit, or simply F10 and enter
'yes' when asked if you want to save on exit.
Now connect to the site using the same format as an
anonymous connection, and it will log you in instantly.
Change ftp configuration settings under Options menu, Virtual FS. This
is where you can change the anonymous password, use of .netrc file,
passive mode and proxy.
would appear that the latest versions of mc don't have samba support,
but it is planned to be included again in the future. If your version
the same way as with ftp, select Left / Right menu and SMB link (or
hotkey B), and a box will open for the machine name, into which I entered the IP.AD.DR.ES. Or, command-line
I'm not a samba expert, so for more commands consult
the man page.
Installing from Source:
First, put on your
patient hat! Read the INSTALL and README files
carefully, especially for the list of libraries
that must be pre-installed, to avoid unnecessary gnashing of teeth. If
you install binary (rpm) versions of the libraries, note that many also
require the -devel packages.
The INSTALL file also gives a list of
configure options - many common ones are on by default, but samba and undelete must be selected on.
And, when I installed version 4.7.1, the binary
landed up in a strange place well out of the normal path.
CD burning: A cd burning
patch, MC-Burn, is available from Friesoft,
but only as a tgz.
MC can recover deleted files on Linux/Unix. Works on ext2 and ext3
help: For a detailed guide by the developers of Midnight
Commander, see here.
- su to root and relaunch mc
- it is recommended to unmount the affected partition: umount /dev/sda2 (your partition)
- access Command menu, Undelete files and enter your
partition in the box
- after a few moments search, it will show a directory
containing the inode numbers (the file contents, missing the header or filename)
- Sort and arrange by time, size etc. through Left /
Right menu, Sort Order
- F3 to view the contents of a file
- Copy required files over to a new directory on your
- if unmounted, remount partition: mount /dev/sda2
- rename and move your recovered files back.
Official FAQ here.
Commander for Mac
I have successfully installed MC for Mac on two different machines:
On 10.4 Tiger, I installed mc using Rudix according to
the instructions on Michigan Telephone. Choose your rudix version carefully - read Michigan Telephone first.
I recently installed MC on 10.7 Lion using a universal binary from http://louise.hu/poet/?tag=mc This includes all the libraries and was lighting fast to download and install.
Mouse support: not possible in Terminal.app, so run it on iTerm http://www.iterm2.com/#/section/home
The F key problem: Easiest fix for regular users - open System Preferences -> Keyboard, tick to use the F keys as
function keys. Otherwise, use Ctrl-t in
place of the insert key to select
multiple files, and Esc - 1-0 in place of the F keys.
This page uploaded in a flash using Midnight
Access the network and external drives by mounting the drive first in
Finder, then select it from 'volumes' in the root directory.
Jane Trembath, Benoni
Edited November 2011
Corrections and suggestions welcome
top of page