Home > ubuntu > Configure Midnight Commander to open files with custom application

Configure Midnight Commander to open files with custom application


You use Midnight Commander (mc) for all your file operations. So far it’s not a problem :) However, when you hit Enter on a file, you would like to set what application mc should use for opening the given file.

For instance, you want to open an .avi file with VLC instead of X player, etc.


Steps to follow:

cd ~/.mc
cp /etc/mc/mc.ext .
ln -s mc.ext bindings

That is, copy the global mc.ext to your local .mc directory and put a symbolic link on it called bindings. Now you can start customizing your local mc.ext file.

Don’t forget to restart mc after editing mc.ext!


(1) You want to open all your video files with VLC. You also want to add support for .wmv files.

# add these lines

# modify the include/video section
    #Open=(mplayer %f >/dev/null 2>&1 &)   # for mplayer
    Open=(vlc %f >/dev/null 2>&1 &)   # for VLC

(2) Open .docx files with OpenOffice.org.

# add these lines
    Open=(ooffice %f &)

(Thanks for the mc mailing list for their help).

Categories: ubuntu Tags: , , , ,
  1. Miggs
    February 11, 2011 at 02:30

    Isn’t there a way to use aliases so you can easily replace the default apps in case you change your mind?

    alias text_editor=geany
    open html with text_editor
    open other with text_editor

    It would be easier this way..

  2. February 11, 2011 at 03:03

    @Miggs: I don’t know if using aliases in mc.ext is possible. But if you want to change the external viewer (you call it with F3 in mc) and the external editor (F4), there is an easy way.

    (1) Add these lines to your ~/.bashrc:
    export EDITOR=/usr/bin/geany
    export PAGER=$EDITOR

    source ~/.bashrc or open a new terminal

    (2) Tell mc to use an external viewer/editor. Go to Options -> Configuration… and untick “use internal edit” and “use internal view”. Save settings.

    From now on, when you want to view a file with F3 or edit it with F4, mc will call geany. If you want to use a different viewer/editor, just edit your ~/.bashrc file.

  3. December 15, 2011 at 12:19

    Nice! This helped me so much. I wanted to open .pls-Files with vlc, but xmms or mplayer was default. Thank you so much. Its very simple if you know how.


  4. Vogel
    April 23, 2013 at 18:39

    Opening docx and xlsx files that way does not work for me.
    mc enters them as archives instead.

  5. Mark Dwyer
    May 7, 2013 at 16:10

    Thank you for these steps. For my 32-bit 12.04 system, the mc.ext that mc reads is in ~/.config/mc. Adding mc.ext and binding (as a link) to my ~/.mc folder did not help.
    From the mc Menu, Command > Edit Extension File brings up ~/.config/mc/mc.ext. Editing this file allowed me to open pdf files.

    • May 7, 2013 at 17:47

      True, the config files moved to ~/.config/mc some time ago. What I did is in my home directory I created a symbolic link called “.mc” that points to ~/.config/mc .

  1. January 2, 2011 at 09:17

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: