Is there a command line switch or configuration option so that MC starts in terminal mode (same as if I would press ctrl-o after running mc).


The mc(1) manpage mentions no such option.

Looking around in the source shows that this action can be bound to a different key sequence, using Shell = ... in the keymap file, but that doesn't help invoke it at startup. It may also be invokable through a callback using the MSG_ACTION event, but I couldn't see a way to reach that from outside the process.

One possibility is to have the Ctrl-o sequence sent automatically when you start mc. If you are running mc in a terminal emulator on X11, you could do this using an X automation tool such as xdotool. Put

xdotool key ctrl+o

in your ~/.local/share/mc/bashrc (or equivalent if you are using a different shell).

If you want to enable this only some of the time, set up an alternative config directory and point to it with the environment variable MC_HOME. You would need to put that same xdotool line in ~/alt_mc/.local/share/mc/bashrc, and start mc with

MC_HOME=$HOME/alt_mc mc

This will require duplicating/symlinking any other mc config settings and files that you have in the usual place.

  • Thanks for xdotool but I wanted this behavior only when requested i.e. I want to assign something like "gnome-terminal -e 'mc --run-shell; exit'" to keyboard shortcut. In other cases I want mc to behave normally. – Trismegistos Sep 16 '16 at 15:29
  • You could do that with an alternative mc config dir. Edited to demonstrate. – JigglyNaga Sep 16 '16 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.