Posts Tagged ‘mc’

Midnight Commander: remember directories on the left and right sides when you quit

August 21, 2015 5 comments

When you suffer enough, you will want to change. Nobody likes suffering. I’m a huge fan of MC but one thing troubled me for months: when I quit MC and restart it, it doesn’t remember the last directories in the left and right panels.

As it was driving me crazy, finally I decided to look after the problem. As usual, the solution was just 1 minute away.

A quick Google search dropped out this thread. That is:

Menu->Options->Panel options...
[x] Auto save panels setup
Categories: linux Tags: , , ,

Midnight Commander tips

Copy the name of the current file to the mini shell:
“Esc+Enter” (i.e. press Esc, release, then press Enter)

I already knew this. Here are some new ones that I learned today:

The one above has an alternative shortcut:

Paste to the shell the path of the selected panel:
“Esc+a” or “Ctrl+x p”

Paste to the shell the path of the unselected (other) panel:
“Esc+A” or “Ctrl+x Ctrl+p”

These are actually in the man page, so it would be a good idea to read it once :)

Thanks to Andrew B. on the mc mailing list.

Categories: bash Tags: ,

Disable Unity’s F9

I use Midnight Commander a lot and F9 in MC means: “go to the top menu bar“. However, Unity steals F9 and activates a widget layer. By default this layer is empty, so you only see that the screen greys out.

How to disable this shit?

Start “ccsm“, find the Desktop section and untick “Widget Layer“. Done.

MC: get the same folder in the other panel

In Midnight Commander, you want to see the same folder in the other panel.


Alt + i

It can also be a good idea to run through the manual for more tricks: “man mc” :)

mc doesn’t open zip files

After I upgraded Ubuntu to 12.04, I also updated mc from source. The current stable version is However, these recent versions of mc introduced some novelties. For instance, using the old mc.ext files, they won’t open archives :(

Another novelty is that the folder of mc was moved from “~/.mc” to “~/.config/mc“. So I moved my mc.ext file to the new location. I also had a symbolic link called “bindings” that pointed to mc.ext, it was moved too. Then I removed the obsolete folder ~/.mc.

Now, update your mc.ext file to the new format in order to open archives:

cd ~/.config/mc
mv mc.ext mc.ext.old
cat mc.ext.old | sed 's|\(Open.*\)#\(.*\)$|\1/\2://|' > mc.ext

Restart mc and opening the archives should work now.

This tip is from here.

Categories: ubuntu Tags: , , ,

mc problem: cannot chmod target file, operation not permitted

March 25, 2012 Leave a comment

With mc, you want to copy lots of small files to an NTFS partition. However, for every file it drops a warning: “cannot chmod target file”. Either you switch to root or you sit next to the keyboard and press Skip for every single file. WTF?

When you press F5, untick the option “Preserve attributes“. Done.

Install Midnight Commander from source

August 10, 2011 6 comments

This post is deprecated. Repositories nowadays contain a modern version of Midnight Commander, so it’s not necessary anymore to install it from source.

I’ve already noticed that the Ubuntu repositories are sometimes very out-of-date. A good example for this is the “mc” package. There is a PPA for Midnight Commander that should solve this problem but it’s also very old. At the time of writing (August 10, 2011), the current stable release is while the PPA contains the version (updated on Sept. 15, 2010).

Since I wanted to use a fresh release of MC, I installed it from source. Steps to follow:

  • Download the latest stable source and unpack it.
  • For a successful compilation I had to install this package too: “sudo apt-get install libslang2-dev libglib2.0-dev”.
  • ./configure
  • make
  • If it was successful then you should have a binary “mc” file in the src/ folder. If it’s there, you can remove your current version with “sudo apt-get remove mc“.
  • Then install the new version with “sudo make install“.

I also had to modify my .bashrc a bit:

# old:
#alias mc='. /usr/share/mc/bin/'
# new:
alias mc='. /usr/local/libexec/mc/'

Update (20120505)
Installing mc from source is now integrated in jabbatron.

Categories: bash, ubuntu Tags: , , ,

Ubuntu 11.04 Natty Narwhal

April 29, 2011 5 comments

Yesterday I installed the newest Ubuntu on my machines. The upgrade went smoothly, there were no problems. I collect here my notes about this new release.

If you want to upgrade several machines, read this post. With this “trick” you can reuse the downloaded packages on other machines too.

Unity redefines F10. As I use Midnight Commander a lot, it’s quite annoying as F10 means “quit” in MC. A workaround is to use ESC + 0 in MC, but that’s a PITA. Also, I assigned something to F10 in vim… Here is how to disable F10 in Unity: (1) install compizconfig-settings-manager and start it, (2) filter “unity” and start the Ubuntu Unity Plugin, (3) edit “Key to open the first panel menu” and disable it. Now everything is back to normal.

With CTRL + ALT + T you can start a new instance of your default terminal emulator. I use terminator, so here is how to make it the default: click on the power button in the top right corner and choose “System Settings”. On the left side at the bottom you will see “Set Preferred Applications”. Start it, and under the System tab specify your favorite terminal emulator.

Want to monitor the RAM / CPU usage? Execute the following commands:

sudo add-apt-repository ppa:alexeftimie/ppa
sudo apt-get update
sudo apt-get install indicator-sysmonitor
indicator-sysmonitor &

I use this customized output: “| CPU: {cpu} | RAM: {mem} |”. To edit it, right click on the applet and choose Preferences.

Is the Dropbox indicator applet gone? Here you will find a fix.

Missing the weather indicator? Execute “sudo apt-get install indicator-weather“. (via webupd8)

Unity wallpapers with shortcuts: here.

After playing one day with Unity, I found one thing very frustrating: there is no bottom panel for the applications, so I never know what programs are running. I noticed that I was pressing ALT + TAB a lot… I was already thinking of switching back to Ubuntu Classic when I could figure out how to get the bottom panel back. You just need to launch “gnome-panel” and customize the new panel. Add it to your startup applications, this way it will be launched each time you log in. It also added a top panel that I removed (right click, delete). Customization: right click and add “Window List” and “Workspace Switcher”. Since this is a classic panel, you can add all those applets that are missing in Unity, for instance the “System Monitor”.

If you find the global menu (File, Edit, etc. are on the top panel like in MacOS) annoying, here is how to get rid of it (via webupd8):

sudo apt-get remove appmenu-gtk indicator-applet-appmenu indicator-appmenu

Log out and log back in to take it into account. (edit: same thing in 11.10)

Under Eclipse I had a strange problem. Sometimes it crashed with the error message “The program ‘Eclipse’ received an X Window System error.” I found the solution here. In short, I had two xulrunner instances on my system, versions 1.9.1 and 1.9.2. Fire up Synaptic and remove 1.9.1.

With Firefox, I also had some strange problems. I couldn’t drag and drop an URL from the location bar to the Bookmarks. Or, sometimes the popup menu activated with the right mouse button disappeared when I moved the mouse pointer above it. The following command solved these problems:

sudo apt-get remove firefox-globalmenu

If you don’t like the new overlay scrollbars, here is how to get rid of them:

sudo apt-get remove overlay-scrollbar liboverlay-scrollbar-0.1-0

This tip is from here.

Categories: ubuntu Tags: , , , , ,

Open Konsole from Nautilus

March 3, 2011 Leave a comment

The following entry is based on the post “Nautilus Script to Launch a Terminal” by Linerd.


For navigating in the file system, I usually use Midnight Commander. However, sometimes it’s useful to switch to a graphical file manager, which is Nautilus under Gnome. For instance, browsing images with Nautilus is easier since it shows thumbnails. After using Nautilus for a while, I want to continue my work in a terminal (my favorite is konsole) in the current directory. How to do that?

Related work

There is a plugin in the repositories called “nautilus-open-terminal”. By default, the plugin calls gnome-terminal and it seems konsole is not supported :(


In this post, I found a simple and working solution. Here is the script:

#  Nautilus script - terminal-here
#  This script will open a GNOME Terminal in the current directory.
#  Written by Linerd in August, 2009 -
#  Modification:
#  * konsole-here
#  * Open the Konsole terminal emulator in the current directory.
#  Save this script under $HOME/.gnome2/nautilus-scripts/terminal-here. Make sure that
#  you give this file executable permission. { chmod +x terminal-here }
#  This program is free software.  It is distributed in the hope
#  that it will be useful, but WITHOUT ANY WARRANTY; without even
#  PURPOSE.  See the GNU General Public License for more details.

if [ "$NAUTILUS_SCRIPT_CURRENT_URI" == "x-nautilus-desktop:///" ]; then
        DIR=`echo $NAUTILUS_SCRIPT_CURRENT_URI | sed 's/^file:\/\///' | sed 's/%20/ /g'`

# gnome-terminal --working-directory="$DIR"
konsole --workdir "$DIR"

exit 0

The konsole modification was suggested by James in a comment in the previously referred post.

Installation: Save it in the directory $HOME/.gnome2/nautilus-scripts under the name konsole-here.

Usage: Right click in Nautilus, then choose Scripts -> konsole-here.

Launch Nautilus from terminal

When I want to launch Nautilus from the terminal, I use the alias “nh”, which stands for “nautilus here”, i.e. open Nautilus in the current directory:

alias nh='nautilus . 2>/dev/null'

Simply put this line in your ~/.bashrc file.

With this alias and with the script above, you can easily switch back and forth between Konsole and Nautilus.


  • Linerd, original script with gnome-terminal support
  • James, konsole patch


There is one thing that troubles me. If I open a konsole from Nautilus, the newly opened konsole gets no focus :( That is, you cannot type immediately, first you need to click on its window. However, if you call the script from the Desktop, konsole gets the focus… If someone has a solution for this, please let me know.

Update (20110304): I think I have a solution for the problem. After switching off the visual effects, konsole gets the focus. Damn… Here is how to get rid of the eyecandy: right click on Desktop -> Change Desktop Background -> Visual Effects tab, select None.

File manager with copy queue

February 15, 2011 1 comment


Under Windows, I use Total Commander. Under Linux, my favorite is Midnight Commander but there is one thing that I miss a lot: copy queue. That is, I would like to send copy tasks in a queue. If you open several MC instances and you start a copy task in each, it will be very slow. Windows’ Total Commander has this function. Is there a file manager under Linux that can do that?

This feature is very useful when you want to make a compilation. For instance, you go to a friend with your external HDD, you browse his movie/music collection on his machine, and you just put in the copy queue what you like. At a given moment only one file is copied, so the system stays responsive.

Solution #1

The file manager Krusader knows this. Copy queue works exactly like in Total Commander: F5, then F2.

First, install krusader:

sudo apt-get install krusader

apt-get will suggest several extra packages (unrar, 7zip, unace, etc.). It can be a good idea to install them too.

When I put a shortcut on my desktop, an empty icon was associated to the application :( You can download a nice icon from here.

Solution #2 (update 20110928)

You can also try Double Commander, which “is a cross platform open source file manager with two panels side by side. It is inspired by Total Commander and features some new ideas.”

Installation from PPA:

sudo add-apt-repository ppa:alexx2000/doublecmd
sudo apt-get update
sudo apt-get install doublecmd-gtk

I’ve read about DC here (in Hungarian).