Hacker News new | past | comments | ask | show | jobs | submit login
Midnight Commander Tips and Tricks (softpanorama.org)
172 points by ingve on Jan 30, 2022 | hide | past | favorite | 61 comments



Alternatives for terminal are:

lf (https://github.com/gokcehan/lf)

nnn (https://github.com/jarun/nnn)

lfm (https://github.com/langner/lfm)

vifm (https://vifm.info/)

ranger (https://github.com/ranger/ranger)

With UI (cross platform):

muCommander (https://www.mucommander.com/)

DoubleCommander (https://doublecmd.sourceforge.io/)

fman (https://fman.io/)

Camelot (https://github.com/IngvarX/Camelot)

I prefer lf and muCommander (only for simple ops, though), for sync and resumable copy I use rsync and rclone.


Any suggestions for good performance and extensibility? I've tried a few but kept coming back to Midnight Commander for performance/stability and VFS support.


If GTK is acceptable, maybe try gentoo [1]. It's not very well maintained "lately", but performance used to be a goal and it sure has a lot of settings.

Disclosaroo: I wrote it.

[1] https://en.m.wikipedia.org/wiki/Gentoo_(file_manager)


Ranger and Emacs dired are my goto's, but I'm not sure about fuzzy file searching, since I archaicly still manually find for stuff.


wondering, what do you miss in mc that you look for alternatives? (not saying mc is complete, just curious!)


Things I wish mc had:

- Extensibility (e.g. Far Manager has macros, plugins, and scripting; mc has none)

- Better file system navigation (pressing Ctrl+S every time to start isearch when entering a directory is cumbersome)

- Better history (no search; the history file is clobbered on exit, overwriting other instances' history)

- Generally better ergonomics that don't rely so much on the hard-to-reach F-keys

- Things like built-in image viewer that are present in modern file managers are absent in mc

- Development velocity seems to be rather low; not sure why, perhaps because it adopted GitHub only relatively recently.

mc features that I wish other file managers had:

- Stable (no crashes)

- Packaged in all major distributions, so can be installed and used anywhere

- Fairly good performance (asynchronous listdir/stat would make this even better)

- VFS for archives and remote hosts (FUSE/sshfs can be flaky)

- File management features which are standard for Norton clones (but not for many new file managers like ranger), such as searching in files (and operating on the results)

- Runs in a terminal, so can be used via SSH


thanks!

re: extensibility -- mc does have scripting [1] (although not sure if you meant something else)

re: image viewer -- hmm how would that work considering mc is running in terminal? I guess it could interact with some sort of modal window for file previews or something like that.

[1] https://github.com/MidnightCommander/mc/blob/master/misc/mc....


> re: extensibility -- mc does have scripting [1] (although not sure if you meant something else)

Scripting in the sense that the application exposes an API that scripts can interact with to query data or perform actions, usually to an equivalent capacity as to what the user could do themselves.

In the case of Far Manager, the Lua scripting API exposes the same API as for plugins, which allows complex integrations such as implementing custom UIs and VFSs.

> re: image viewer -- hmm how would that work considering mc is running in terminal? I guess it could interact with some sort of modal window for file previews or something like that.

Well, there's a whole bunch of methods. Many terminals support at least one protocol for drawing bitmaps, such as Sixel; ranger uses the simple method of overlaying an X11 window on top of the terminal emulator's.


There is a fork of mc that adds Lua scripting support [1], but it hasn’t been updated since 2016. There were also talks about merging it with mc [3], alas never happened.

[1] https://www.geek.co.il/~mooffie/mc-lua/docs/html/

[2] https://github.com/mooffie/mc

[3] https://midnight-commander.org/ticket/3745


Fuzzy file search, the current ctrl-s implementation doesn’t quite do it for me. It would also be nice to have a shortcut, that filters current directory.


I did not look for alternatives, but in some of the good old linux resources sometimes super new and fancy file managers come up and I took notes on these, because I always planned to develop my own file manager with terminal UI...

Especially vim shortcuts are often a thing - I personally like single file binaries that are portable, have sane defaults and easy to setup without root permissions (like lf).


Krusader


I have convinced my wife that Midnight Commander is an excellent name for our future black cat.


That's awesome. Plus you could chill late at night and listen to Norton Commander together.

https://www.youtube.com/watch?v=qmVeQEysvtk


When I learned linux and dug deeper into programming mcedit was my tool of choice and I used it a fairly bit until I discovered emacs and took some very painfull and time consuming approaches to get into emacs. (Partly I was offline and the nature of a self documenting OS and text editor was novel for me and so enlightening.

Later I tried to get better and standard terminal stuff and abandoned mc from my system so i couldnt cheat around. These day, my GF uses mc sometimes to get very basic things done.


I never used pc clones when I was a kid. It was an Amiga for me, and in my world Directory Opus was king. It still is on my windows pcs these days. Great software and still actively developed.

Come to think of it, I no longer recall what Windows Explorer actually looks like.


Yes, Directory Opus is outstanding. I'm an Emacs fanboy to an intense degree, but I've never bothered to learn Dired. Directory Opus, although mouse-driven, is simply too powerful.

What is this Windows Explorer of which you speak?


Ha, I'm the opposite - not a hardcore Emacs user but I use dired whenever I can. wdired-mode is such an intuitive way to do bulk renaming.


For bulk-renaming, I love ranger's :bulkrename command, which I think calls out to an external program, vidir or something. It opens the list of files in vim where it becomes very fast to do edits to them. Easy copy/paste, flipping between upper and lowercase, etc. You can do the same edits on multiple lines using visual mode. It all works how you'd expect if you know vim.


Checkout Worker if you want something like DO for X. It's very fast and very configurable!

http://www.boomerangsworld.de/cms/worker/


I made a Midnight Commander Guide (as a presentation) years ago:

http://blog.nawaz.org/posts/2012/Dec/a-guide-to-midnight-com...

And yes, definitely FAR Manager on Windows!


The actual Midnight Commander Guide PDF link leads to a "repository not found" page on Bitbucket. Archive.org still has a single copy, dated December 2014.



Oh - did not realize that the actual PDF was also on Bitbucket. I'll rehost it elsewhere. Thanks to both of you for alerting me to this!


Yes - Bitbucket killed it and I didn't bother moving to another repository.


FAR works great in Linux as well as in MacOS:

https://github.com/elfmz/far2l


I can't think of another tool which evokes the same level of recursive nostalgia as Midnight Command. Firstly, that it was the environment I spent most of my forays into Linux inside. And secondly, that I only fell in love with it because of Norton Commander in DOS (one of the main uses for which was setting up a parallel cable connection to my brother's PC to play DOOM together).


Speaking about 2-paneled file managers, I’m still a fan of Far Manager on Windows.


Total Commander all the way


Nothing ever comes close... Welp only Double Commander, the gpl reimplementation :)


I remember this holy war. :)

I think Far Manager wins in extensibility and being FOSS, and Windows/Total Commander wins in out-of-the-box utility.


29 years old and still going :-)


I like MultiCommander[1], which I've been using for many years, because it's quite feature rich.

It would be great if there were some in-depth, feature-by-feature comparisons of all these two-pane file managers.

[1] - http://multicommander.com



It's been a minute since I've thought about mc--which is the point, I reckon.


> If you use vi, Vifm gives you complete keyboard control over your files without having to learn a new set of commands

https://vifm.info


""" You need to take some steps to make MC to exit in the current directory visible on the screen. One way is to use alias such as

alias mc='mc -P "/tmp/mc-$USER/mc.pwd.$$"; cd `cat /tmp/mc-$USER/mc.pwd.$$`; rm /tmp/mc-$USER/*'

The other is to use a supplied with mc more generic script

alias mc='. /usr/libexec/mc/mc-wrapper.sh'

One of the most common problems with mc is incorrect display of pseudo-graphical characters, which spoils borders on the panels and while this defect does not affect functionality, is very unpleasant aesthetically. See Midnight commander does not display pseudo-graphic characters properly for more information. You can use option -a to use regular characters instead and in most cases this is an adequate solution. """

Hell, no. I am glad I learned vim and I am still using it a lot but I am not going down another rabbit hole where easy and simple things are ... contorted. And I don't want to take care about another configuration file in order to feel at home. I just want sane defaults, simple things made easy and complex task possible. What I like about vim is that the modal editing paradigm. All the rest could be better and whenever Neovim or Helix or Amp or Onivim or any other terminal editor/ide is 1.0, I'll jump ship. Navigating files with the command line is not that complicated imho.

I don't blame Vim, maybe it was not meant to be an IDE. Maybe we need a terminal IDE.


You don't need to set up that alias. I'm guessing it's a holdover from the DOS days with Norton commander where you would launch nc just to quickly navigate to a directory and then quit it, which can't easily be done on Unix.

(the current drive/directory was global state in DOS - it even recorded the current directory per drive, but that may only have been command.com doing that)


Note that this kind of scripts is a security issue if the system does not implement per-user tmp directories, especially if it regularly cleans the /tmp directory. Which this script appears to expect.


There is only one true god, an 800MB beast - Total Commander Ultima Prime[0]

[0]https://www.tcup.pl/forum/showthread.php?tid=3125


The article mentions it, but my favorite mc option is enabling lynx-like motion. Being able to left/right arrow in and out of directories is so convenient!


Lynx itself is a modest fm. It has a host of editing and file/directory commands. The first entry in my lynx menu is ~/


The regression from Windows Explorer and OSX Finder to Midnight Commander is absolutely amazing.

We have only gone backwards, in all aspects, from performance to usability.


I don't understand your comment. Midnight Commander is not a new tool. It is based on Norton Commander, which precedes the tools you mention by years.


Parent means regression from MC to windows explorer and MacOS finder. I agree, both have added tabs in recent years but I miss the dual directory view in MC. And for that matter, in many tools from about 20 years ago.


do you think Finder is better than mc/nc?


DOS Navigator baby !!!


Muxe's fork is still alive and kicking! http://www.ndn.muxe.com/


The number of stale links on that page is kind of sad.


MC always brings a lot of nostalgia and the though that I used to be extremely productive with it. Surely it's just a mirage of my memory and it's just I don't perform so many file managing actions anymore, but I remember not even bothering with Windows Explorer until at least XP.


Does mcdiff support a side-by-side diff, similar to 'diff -y'?


I do have mc installed, but Double Commander remains the first choice owing to:-

- Tabs

- Multi-file rename


For multi-file rename, vidir is excellent https://linux.die.net/man/1/vidir


Btw, I just figured out that Double Commander has the very same capabilities too. You can get the list of selected file names in an editor, make the necessary changes and save.

Multi-rename tool > Editor (bottom right). Ctrl+M is the shortcut for Multi-rename tool.


Thanks for suggesting this tool. Didn't know about it until now. From what I have read, sounds like a powerful tool and I would be trying it out.


I also love Double Commander for its "synchronize" functionality. And the fact that I can't be arsed to use a text-based interface in a graphical environment. In terminals, of course, mc is the jam.


Double Commander is really nice, a favorite for sure.


mc supports multi rename, for example try rename `*.foo` to `*.bar`.


In Double Commander, it is a sophisticated tool in itself. Regular expression based, with substitution. There are additional bells and whistles such as counters, capability for character conversion etc. You also get to preview before committing your changes.

I also figured out, just a while back, that one can even edit filenames in the editor and save to get the changes reflected in the file-system.


ZTree Gold, my friends, is what I miss most dearly ever since I moved my whole life to Linux.


Midnight Commander is such a great name for a dirty flick.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: