Forcing Midnight Commander
#188 Henry, Saturday, 05 July 2014 7:35 PM (Category: UNIX Tools)
(Tags: mc midnight commander)

I have a theory that most really useful utilities get improved to the point where they are awful.

I've been using Midnight Commander (mc) at the command line, in xterms, since 1994. 20 glorious years of useful use. But lately I've been struggling with it. The defaults keep getting changed, or else the distribution defaults get changed, and I have to keep making over-riding corrections so I can keep doing what I want to do.

First of all, I don't want to exit from Midnight Commander and be in the last directory I accessed. Given that this is default Slackware behaviour, I would guess that many people want this. I do not. So every time I do a new installation, or upgrade Midnight Commander, I make the shell scripts in /etc/* not executable.

Then I want to be in the left pane when it starts. I want Midnight Commander to start with my focus in the left pane, and if I told it to start in a directory, I want that directory to be in the left pane. I have it doing this now, but I can't work out how I did it.

But the thing that has started driving me to a rage is what directories it displays. I don't know what other people want, but I want the absolute simplest approach.

If I type mc with no parameters, I want left and right panels to be the current directory. If I type mc with one directory after it, I want left and right panels to both be set to that panel. If I type mc with two directories after it, I want the first one to be in the left panel, and the second one to be in the right panel. That makes sense to me, but I can't configure mc to give me that. Maybe I am just not reading the right parts of man or the documentation. Anyway, I have conquered this with brute force.

First, I have an alias so if I type mc, it runs my mc script in $HOME/bin.

Second, that script does exactly what I described up above.



if [ "$DIR1" == "" ]; then
if [ "$DIR2" == "" ]; then

/usr/bin/mc $DIR1 $DIR2

And with that in place, my blood pressure and my rage have subsided. Now it doesn't matter what the defaults get turned to, my use of mc will be the way I want it, how it makes sense to me. I am grateful that I can control this, to allow me to do things my own odd way.