Settings

Theme

Use Midnight Commander like a pro (2015)

klimer.eu

178 points by pangey 2 years ago · 98 comments

Reader

pantulis 2 years ago

Some colleagues believed I was some kind of Unix demigod when they were working with SunOS ksh command line and I had my own copy of mc (probably downloaded from Solaris Freeware site or something like that).

There's one powerful thing that mc does and almost any other dual file manager omits: it has the concept of "pop up menus" for commonly used commands --with the option of sending the selected file(s). Also, these menus can be global or local, configured for each specific folder or in my case working copies of some proprietary version control repositories (Subversion was too cool then).

Not only viewing files with F3 instead of using 'more' made you go significantly faster when there was no IDE to quickly grok a codebase, in ancient times where version control and diffing and merging was not exactly like today this was extremely powerful, only surpassed by Emacs.

Edit: to add that in macOS Forklift has something like this in a specific "Tools" section.

  • Sakos 2 years ago

    I've experimented a lot with making my own CLI programs to change how I interact with the terminal, for example wrapping things like cp and mv in a stateful way. I feel like I'd reached some form of enlightenment when I was able to do

    > cp file

    > z folder (which is deeply nested somewhere else)

    > paste

    instead of having to type everything out.

    It feels to me like the possibilities of the CLI and how we interact with it have barely been explored.

  • TacticalCoder 2 years ago

    > There's one powerful thing that mc does and almost any other dual file manager omits: it has the concept of "pop up menus" for commonly used commands

    I never really used mc because once I switched to Linux I became an Emacs user but... I have fond memories of Norton Commander on my 386 PC (running DOS, before Windows 95 became a thing). I think Norton Commander was first and mc was a clone of Norton Commander (even copying the color scheme). And Norton Commander, IIRC, already had these "popup menus" (but my memory may be playing me tricks).

  • anthk 2 years ago

    mc was uber-fast on reading docs from /usr/share/docs, often in .gz format.

Brian_K_White 2 years ago

I always felt sort of embarassed that I use mc 24/7 for everything. I live in it. It might as well be my login shell. I even use mcedit for about 80% of text editing outside of geany or codeblocks.

I don't have any actual reason to be embarassed, since I'm actually perfectly comfortable in vi and and the command line on some old sco box without mc available, it's got to be just because I started among guys who themselves were even older unix guys who never touched anything like mc. Also it felt kind of like still using training wheels when I had been using xtree on dos before encountering unix. But hell I started on xenix myself and still miss some features from ksh93 vs the latest bash5. I haven't needed to live up to anyone else since forever.

But embarrassed or not, I used it all day every day since the late 90's at work and home. It just makes the most sense to be using essentially a browser for that.

For one thing I simply see more stuff.

In the past, every day at work I'd see random junk left all over the place by other employees who clearly didn't even know that they had created these junk files and directories all over the place from having flubbed the syntax of command lines, or botched quoting or escaping inside programs they were writing. Files with names that looked like various other bits of command syntax from quoting mistakes etc. And still sitting there because if you don't actively ls, then you don't see it. I was constantly cleaning up stuff like that back before we finally went to individual developer vms.

  • wkat4242 2 years ago

    Don't feel bad. It's a much better way of poking around than typing ls, cd etc.

    Also, a common usecase for me is having a folder full of files dumped together and I want to move some of them according to arbitrary criteria. Marking them with Insert in MC is so so much less work than typing everything.

    Being good at something is also using the right tool for the job. CLIs shine at some things. TUIs and GUIs at others. They're complementary. It's not like one is better than the other.

jrm4 2 years ago

As something of an old-timer here, there's some amusement, but mostly appreciation that people are discovering that these very old ways of doing things have a lot of potential (and a lot of untapped ideas)

Somewhat relatedly, recently I discovered the colorfully named fff. It's a solid file manager, but what I've used it for is a terminal based filespace navigator (by adding a function that just leaves you in the place you navigated to).

It's funny how it's hard to break the habit of "cd" to move around, despite this being way faster, especially if you're not sure where you're going.

https://github.com/dylanaraps/fff

clemensnk 2 years ago

I've been using Marta on the Mac (https://marta.sh) and I really enjoy having a dual-pane file manager with an integrated terminal where navigating the folder hierarchy is synchronised in both directions.

Marta doesn't seem to be actively developed anymore, so if anyone know of a good alternative I am all ears. fman (https:/fman.io) looks nice, but I don't think it has terminal integration.

dang 2 years ago

Related:

Use Midnight Commander like a pro - https://news.ycombinator.com/item?id=27086555 - May 2021 (1 comment)

Use Midnight Commander like a pro - https://news.ycombinator.com/item?id=9472409 - May 2015 (11 comments)

SonOfLilit 2 years ago

I recently had to use Windows a bit and went back to Total Commander after years on a mac.

It felt amazing. "At last, my arm is complete again" level. I can't believe you could miss a file manager so much. It's one of the greatest tools you can't explain the usage of, you bust have to use it for a week.

Then I discovered that since I last checked a passable Mac clone has appeared. Nimble Commander (https://magnumbytes.com/) is almost 1:1 in terms of UX and does support the Mac filesystem well. Just be sure to press ^3 Tab ^3 the first time you open it.

  • Bagged2347 2 years ago

    That key combo you're referring to when opening; what's that for?

    • SonOfLilit 2 years ago

      Changing both panes to "detailed list view", which is the only view you'd ever want but strangely not the default.

busfahrer 2 years ago

I don't often use a file manager, but when I do, I use ranger. It's mostly for use cases like "delete everything in this directory but these 3 files" and navigating deep directory structures with many files. However, recently I've also begun to use a mix of "z" and the "cd" feature/bash-binding of fzf.

I like that ranger allows me to use vim key bindings, which matches nicely the rest of my system which is centered around i3 and vimium.

cyberax 2 years ago

Or you can try FAR Manager. It kept me from switching from Windows to Linux for a long time, back in 2000-s.

It's now available on macOS and Linux.

mherrmann 2 years ago

Shameless plug for my more modern, GUI alternative to Midnight Commander, https://fman.io.

  • wonger_ 2 years ago

    I used this for a year and really liked it! The change dir by frequency (frecency?) (Ctrl+P and search), the command palette (Ctrl+Shift+P and search), and immediate type-to-filter were great features. Everything felt pretty smooth and stable. I only switched because I started spending more time in the terminal, and fman was getting a tad slow on my machine.

    It was also my first exposure to a solo developer trying to make income with licenses, which at the time felt annoying, but now I understand completely. Thanks for making me more productive :) such a huge upgrade from the default OS file manager.

    • mherrmann 2 years ago

      Thank you for the kind words and understanding. I'm happy to hear you liked it!

  • anthk 2 years ago

    Well, among emelfm, gnome-commander, krusader, worker...

  • amne 2 years ago

    a for effort, but link to the terminal version of it if you want to call it an alternative

  • hulitu 2 years ago

    Minus points: gray on gray, automatic updates, (custom build system ?). On mc you can configure colors.

  • usrbinbash 2 years ago

    Please explain, how is a GUI file manager an alternative to a CLI based one?

tra3 2 years ago

I just used mc to transfer some pictures from my Mac to my Linux nas for later backup with rclone. I haven’t found a better paradigm for dealing with files than the two way pane. Also enabling lynx like motion makes for really quick navigation.

butz 2 years ago

For users prefering GUI applications, I would like to suggest Sunflower FM, a GTK3 based dual-pane file manager: https://sunflower-fm.org/ As usual with such applications it seems to be a bit on hiatus, but maybe some developers would be interested to lend a hand?

  • yashrk 2 years ago

    All GUI OFM-s I've seen missed the main (IMO) feature of Midnight Commander: seamless integration with the plain shell. In MC I can select files with Ins/*, then run command with %t macro to process selected files, then press Ctrl+o and look to the shell output, then maybe run some other shell commands in the full-screen mode, then press Ctrl+o again and return to the dual-panel mode. Moreover, I can edit shell script with the embedded editor (F4), then press Ctrl+o, run the script, read the output, press Ctrl+o and edit the script if needed.

  • mariusor 2 years ago

    Also double commander is pretty good, I remember it having both Qt and GTK interfaces. Also it's almost a one to one clone of Total Commander, the greatest orthodox file manager in existence.

  • usrbinbash 2 years ago

    And for users of GUIs who are (understandably) fed up with GNOME and all the GTK Stuff, I can wholeheartedly recommend Dolphin, KDEs standard filebrowser.

    Which isn't on Hiatus, doesn't require GTK, and has switchable Split views (aka. dual-pane), and tabs (where each tab may have its own split view).

    • keep320909 2 years ago

      Dolphin isa a bit useless for serious operations. It uses KIO for file operations (copy, move...), that invokes separate API call for every file, and is very slow and unreliable for large number of files.

      Other file managers (Thunar in XFCE) do not have this problem.

      • usrbinbash 2 years ago

        GUI file managers are usually used for things where speed is a non-issue. For anything else, Right-Click "Open Terminal Here".

    • anthk 2 years ago

      Krusader is made for that.

    • lelanthran 2 years ago

      I used Dolphin for a short while, but it's a bit slow and unreliable with large copying.

      Went back to caja.

  • klez 2 years ago

    Last commit on github[0] seems to be from 2 days ago. And the previous one from last april. I'd say that the home page is on hiatus, not the project.

    [0] https://github.com/MeanEYE/Sunflower

overbytecode 2 years ago

I find NNN and Ranger a lot more ergonomic as a UX, but MC’s virtual file system is so good, the ability browse folders seamlessly whether local, remote, zip, tar, jar in the same interface etc is really useful.

pangeyOP 2 years ago

If you prefer to watch video, I recommend this - https://www.youtube.com/watch?v=fJOkuaihAek

msravi 2 years ago

vifm is an awesome file manager for anyone familiar with vi. You can have single/multiple panes and can do operations on multiple files. Renaming/moving/copying multiple files is a breeze. You can also run shell commands on selected files using %f %a %d etc. Also allows filtering and sorting over a host of columns.

Fatnino 2 years ago

My dad used to use Norton commander all the time on DOS.

When I introduced him to midnight commander he was very happy to have basically the same thing but on linux.

glimshe 2 years ago

No file manager has ever approached the productivity I had when using XTree Gold for DOS... ZTree is a modern, but commercial version.

  • Lutzb 2 years ago

    My first DOS PC had XTG pre-installed (courtesy of my cousin). I was so fast using XTG, will check out ZTree now.

jasperry 2 years ago

Honest question about two-pane file managers: I understand that dual-pane is useful when you need to see the contents of two folders for copying and syncing multiple files. But for me, that seems like a minority part of my usage. More commonly, I have multiple tabs for different projects, and within those tabs, navigation is mostly up and down the folder hierarchy within each project. Opening the source and destination folders in the panes every time I want to copy seems like more work than just copy, navigate, and paste.

Can anyone enlighten me about this? Is it just my poor organizational skills?

  • woobar 2 years ago

    When I don't need to copy files even when navigating in a single panel (and just ignoring content of the second one) still have advantages.

    - I get a free ls when I navigate directory structure, and with the keyboard shortcuts I can move much faster.

    - If the panel is ordered by time the moment I open the folder I see most recent files (in some cases I only care about recent files when opening a folder). If ordered by size you see your biggest files first, etc. And all of this is stateful, you don't need to run a command to identify biggest/latest file, do something with it and then go back to check what as the second biggest/latest file.

    - it is easier to check content of the file or an archive

    - two panels also work seamlessly with ssh/ftp/archives/etc. You don't need to remember separate commands to copy files from other sources, you will use exactly same pattern for navigating and copying files.

    I also understand that people who mastered shell don't see this as a big advantage. But it really helps when jumping between mac/nix/windows.

  • JNRowe 2 years ago

    Well, you don't have to use the two pane mode if you don't want anyway. You can switch to single pane mode, use the second pane for file info, use the second pane as a directory tree in the manner of a "regular" single pane explorer, etc.

    To perform your "copy, navigate, paste" task while in mc's single pane mode you could either:

    a) tag files, pop open the second pane temporarily, navigate and copy.

    b) tag files, swap the panes in the background, navigate and copy.

    c) tag files, use the bindings to copy them to the inbuilt command line, navigate and copy. Using the "quick cd" dialog would probably speed this up.

    d) any of the above with inverted target and source movement.

    e) probably a thousand other more sensible ways than the three or cheat-y six I just thought of ;)

  • sandworm101 2 years ago

    If you are moving many or large files, the two-pane mode allows you to see the state of the move in real time. You can also see name conflicts more easily rather than wait for a popup. Sure, you could open up two tabs or two windows, but that is more cumbersome than a single window for the task.

    • jasperry 2 years ago

      I agree with that. I guess my question is: do you always use two panes to copy? And does your file manager have something like tabs for different contexts where you would not necessarily be moving files between them?

      • pcbouman 2 years ago

        When you hit F5 (copy) or F6 (move) you typically get a dialog with the destination of the action where the other pane is pre-entered as a default so can just hit Return to start, but which you can also override by typing something before hitting Return. You can type whatever relative or absolute destination you want without having to navigate there explicitly in the other pane. For up/down one directory I personally type .. or the child-directory, if the destination is further away it is often more convenient to navigate there in the other pane.

      • sandworm101 2 years ago

        Moving a few files, no. But a professional move, say something that is going to take more than 30 minutes due to speed/size issues, yes i would use a two-pane tool. Another case would be if the destination had a dynamic ammount of free space, such as to a running server. I would use two panes so i could abort before filling the destination.

shmerl 2 years ago

The nice thing about Midnight Commander is that it has a hex viewer and editor.

  • oneshtein 2 years ago

    Moreover, editor allows to switch to console via Ctrl-O, which turns it into an simple IDE for console programs: edit code, Ctrl-O, run program, Ctrl-C Ctrl-O, repeat.

    • amne 2 years ago

      I always thought the C-o subshell needed a status bar or something. Not once did I find myself launching mc again because I forgot it was already running. Luckily it warns you when launched from the subshell.

      • JNRowe 2 years ago

        mc sets $MC_SID in the subshell, so you can query that in your prompt to mark prompts running under mc.

        Another option might be to bind F10 to start mc, so that it acts as a toggle whether in mc or in a non-mc shell. You'd need to wrap a zle widget in zsh, or add a '$if Bash' guard to your inputrc with bash.

    • shmerl 2 years ago

      With neovim it's easy also with:

      * Ctrl+Z

      * Do something in the shell

      * fg

  • pangeyOP 2 years ago

    It also can open/browse archive files without unpacking first.

    • hulitu 2 years ago

      It unpacks them in a temporary directory.

      • JNRowe 2 years ago

        Depends on the archive type and how the vfs/extfs code was implemented for it¹. It also depends on how the archive is treated if it is compressed container, which can be seen by looking at how a .tar and .tar.xz are handled for example. The zip handler is probably the easiest to understand, as it doesn't need to contend with external compression wrappers and is a simple perl script. (In some cases it would probably be nicer if it did extract the entire archive to tmpfs, such as when you independently pull a few files from a massive .deb for example)

        Implementing your own extfs scripts to wrap a simple menu around some task can be really useful, far beyond basic archives. I wrote one so that I can shuffle my todo list priorities by moving fake "task files" in to different pseudo-directories.

        ¹ https://github.com/MidnightCommander/mc/tree/master/src/vfs/

jmlucjav 2 years ago

there is a newcomer into the terminal file managers arena that looks like it's going to be what I was looking for https://github.com/sxyazi/yazi (sort of ranger/vifm written in rust, lots of momentum)

  • christophilus 2 years ago

    Hm. That sixel support does look really nice. It’s something I miss with vifm.

    • csdvrx 2 years ago

      I had a project of baking in sixel support into nnn, but got too busy with other things :(

lencastre 2 years ago

It's just frustrating to use autocomplete on the $ shell, it's so ubiquitous to to use Tab to autocomplete that within mc it switches panes. I cannot discover how to "Esc Tab", because pressing Esc then Tab does not autocomplete, pressing and holding Esc then Tab, also doesn't autocomplete, other than that it's the good'ol souped up norton commander.

  • oneshtein 2 years ago

    In mc, Alt-Tab or Esc+Tab two times does autocomplete for command name, but it's much easier just to press Ctrl-O and use shell in full screen, with native autocompletion by Tab, then switch back to mc by Ctrl-C + Ctrl-O. (Without Ctrl-C, mc may not be able to synchronize directories between shell and panel, which often leads to confusion).

who-shot-jr 2 years ago

Take a look at broot https://github.com/Canop/broot

BeetleB 2 years ago

Nice to see this. There is a more visual guide here:

https://blog.nawaz.org/posts/2012/Dec/a-guide-to-midnight-co...

(The guide is a PDF link on that page).

janandonly 2 years ago

I loved using Total Commander back when I used windows.

There is nothing like this for the macOS as far as I know.

  • oneshtein 2 years ago

    Double Commander is what you are looking for:

    https://sourceforge.net/projects/doublecmd/files/latest/down...

    • SonOfLilit 2 years ago

      DoubleCommander is really good in terms of TCMD compatibility (they run TCMD plugins!) but it's useless on a Mac. It's extremely non-native in ways that matter.

      Nimble Commander (https://magnumbytes.com/) is almost 1:1 in terms of UX and does support the Mac filesystem well. Just be sure to press ^3 Tab ^3 ehe first time you open it.

  • neontomo 2 years ago

    Give Marta a shot. It gives Total Commander a run for its money imo. Free.

    https://marta.sh/

    • out_of_protocol 2 years ago

      Total Commander is just too great, never have seen anything coming close, maybe except Double Commander. Double Commander is the closest clone of TC, with many many features in place, but not as smooth and streamlined. Everything else i've tried on non-windows platforms is too barebones, including Marta.

      Copy from older comment, regarding Total Commander:

      powerful mass rename, advanced queue management for file operations, intelligent "resume" for larger file copying - it checks beginning/end bytes plus ~3 random points inside to to be sure you can continue on copying that huge file cut in the middle. You can color files/folders by conditions, e.g. files/folders created today are red and music files with bitrate 128 or lower are gray. Also, lister (built in preview on F3) - you can scroll through dozen-GB sized log file in seconds. Search is great, you can find duplicate images bigger than 512x512 and show them on file panel for any processing. And plugings. Lots of plugins. For archive formats, for lister, for mass-rename, for file system, for additional columns etc

    • prof-dr-ir 2 years ago

      I downloaded Marta and it looks and feels absolutely amazing.

      But then I noticed that it is not open source, the sole developer has been on a break for at least a year, and the issue tracker mentions two bugs that may lead to data loss.

      So I uninstalled it. I will look elsewhere for now.

  • ihateolives 2 years ago

    Commander One. https://ftp-mac.com/?utm_source=c1app&utm_medium=software&ut...

    They advertise as secure ftp solution, but in fact it's a full featured dual pane file manager.

  • themadturk 2 years ago

    I use Path Finder on Mac. Costs more than I'd like, but is far, far better than Finder.

    https://www.cocoatech.io

  • tomcam 2 years ago

    Ranger?

davikr 2 years ago

On Windows, try Altap Salamander. It's free and open-source.

  • HackerThemAll 2 years ago

    There's the free & open source clone of Total Commander - Double Commander. It's compatible with TC extensions, and just like TC also written in FreePascal.

    • gattr 2 years ago

      And Unreal Commander (freeware), also compatible with TC plugins. I'm usually on Fedora, I use Krusader there.

  • lysp 2 years ago

    Another option for windows is ZTreeWin (a clone of the old XTree Gold).

    Fully keyboard based, and has a shortcut (F8) that goes into split screen mode if you need.

  • pangeyOP 2 years ago

    When I was on Windows, I paid for Total Commander. BTW, Altap Salamander is freeware, not open source. It is a decent alternative nonetheless.

  • ihateolives 2 years ago

    Does it support unicode in filenames yet? I ditched it for FreeCommander for that reason.

CTOSian 2 years ago

some other shortcut: ALT+. -> hide/unhide dot files/directories

other dualpane -way faster file operations eg like copy/move than mc- is the Worker http://www.boomerangsworld.de/cms/worker/index.html (Amiga `directory opus` look like)

  • HackerThemAll 2 years ago

    Worker, being a graphical tool, is unusable over a SSH connection or where only a text terminal is available.

    • jrm4 2 years ago

      Yeah, this is the sort of thing that makes one wonder why we haven't been able to settle on a good "mostly text, but maybe a little bit of graphics when necessary kind of a standard."

      Like some kind of sixel + html thing or something.

    • tangus 2 years ago

      It's usable over a SSH connection with X forwarding tho. It all depends on the quality of your connection.

  • bakoo 2 years ago

    Directory Opus was great back in the day, remember the joy of binding a ton of scripts and cli and gui apps to various buttons.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection