I like Midnight Commander. Might have to do with starting with DOS machines in the early 90s in Russia, but now I just really like the integration of the command line with a two-panel file list. And a key feature is that Ctrl+Enter copies the name of the currently selected file or directory into the command line, without starting it.

Unfortunately, on Fedora (26 and 27) this fails in Konsole and, apparemntly, in all other X-based terminals too. It does work in the virtual console I get py pressing Ctrl-Alt-F3.

On OpenSuse Leap (42.1, 42.2, 42.3) the Ctrl+Enter functionality works perfectly. And I could not work out any difference. (I use KDE on both, which, as far as I understand, means that on Fedora I have X.org, not Wayland).

How can I make Ctrl+Enter work on Fedora? Alternatively if this is impossible, is there a way to reassign the very useful functionality to some other key combination in Midnight Commander?

(I would also consider alternatives to Midnight Commander itself, but on;y those running in a console window, and it seems there aren't any. I don't need a graphical two-panel file manager, as I use MC to assist in crafting commands quickly).

  • As a replacement there are also: Ctrl+x t (2-event sequence), Ctrl+Alt+j.
    – AleXoundOS
    Commented Apr 2, 2020 at 17:10

2 Answers 2


tl;dr: Get used to Alt+Enter (a.k.a. ESC followed by Enter) instead.

Ctrl+Enter generates the exact same sequence in terminal emulators as Enter, so there's no way for an app to distinguish these two. Well, no way by looking at the input stream it receives from the terminal emulator.

mc has an interesting feature called "X11 support". It does not only look at the bytes it receives from the terminal emulator, but (if this support is compiled in, and if X11 connection is available runtime) queries the X11 server for the state of the modifier keys.

So basically it goes like: "Wow, I received an Enter from the terminal emulator. Hey, X11 server, is Ctrl pressed now?"

There are multiple ways this might not work for you.

Fedora's mc may have been compiled without X11 support, I don't know. Check the output of mc --version, does it contain "With support for X11 events"?

su, sudo, screen, tmux, ssh or similar tools can also break this functionality in case the X11 connection isn't available inside them (e.g. credentials not properly set up / forwarded by su or sudo; screen or tmux being detached and reattached from another X server; display not forwarded by ssh).

The feature doesn't work on Wayland either. I suspect it cannot be implemented in Wayland due to its security model, or at least not without some plugin/extension to some core Wayland component. But even if the state of modifiers could be detected, it's not yet done in mc.

  • Thanks! Alt+Enter works and that's enough for me right now. Commented Jan 3, 2018 at 14:29
  • 1
    In my case suggested solution do not work (NixOS 19.09). My mc installation With support for X11 events. But Alt+Enter produces nothing. At the same time all other Alt+ combinations do work (Alt+a, Alt+Shift+h, Alt+i, etc).
    – AleXoundOS
    Commented Apr 2, 2020 at 17:01
  • @egmont If Ctrl-Enter is the same as Enter for mc under Wayland, how come "Ctrl-x, t" is working? Following your logic, it'd be an equivalent of simply "x, t".
    – Anton K
    Commented Dec 15, 2023 at 23:08
  • Enter and Ctrl+Enter generate the same sequence. X and Ctrl+X don't. They are different to begin with.
    – egmont
    Commented Dec 16, 2023 at 9:23

We still don't have a replacement for Ctrl-Shift-Enter in MC on Wayland.

So lacking one, I suggest to use Alt-m instead. And because Enter is the same as Ctrl-m, this means we would have:

  • Alt-Ctrl-m, ie. Alt-Enter, for Paste file name.
  • Alt-m for Paste full path name.

Note that by default Alt-m is assigned to the Mail action, so we will lose that mapping but it looks like a winning deal.

Here a (replayable) script to apply this new mapping in the default keymap (file /etc/mc/mc.keymap):

sudo sed -ri '/PutCurrentFullSelected/s/=( alt-m;)?/= alt-m;/' /etc/mc/mc.default.keymap
sudo sed -ri '/Mail = alt-m/s/= alt-m/=/;' /etc/mc/mc.default.keymap

Or the patch:

diff --git a/mc/mc.default.keymap b/mc/mc.default.keymap
--- a/mc/mc.default.keymap
+++ b/mc/mc.default.keymap
@@ -33,7 +33,7 @@ Shell = ctrl-o
 PutCurrentPath = alt-a
 PutOtherPath = alt-shift-a
 PutCurrentSelected = alt-enter; ctrl-enter
-PutCurrentFullSelected = ctrl-shift-enter
+PutCurrentFullSelected = alt-m; ctrl-shift-enter
 ViewFiltered = alt-exclamation
 Select = kpplus
 Unselect = kpminus
@@ -313,7 +313,7 @@ Help = f1
 Refresh = ctrl-l
 Goto = alt-l
 Sort = alt-t
-Mail = alt-m
+Mail =
 ParagraphFormat = alt-p
 MatchBracket = alt-b
 ExternalCommand = alt-u
  • How horrible. It used to work in Unity / X flawlessly. Commented Feb 27, 2020 at 18:56
  • Try these replacements: Ctrl+x t (2-event sequence), Ctrl+Alt+j.
    – AleXoundOS
    Commented Apr 2, 2020 at 17:15
  • @AleXoundOS Could you add some details/references for how 2-event sequences work? I.e. why Ctrl+x t works as Alt+Enter, why it's Ctrl+x and why it's t, and and what other keys could be used.
    – Anton K
    Commented Dec 10, 2023 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .