Archive
MC: get the same folder in the other panel
Problem
In Midnight Commander, you want to see the same folder in the other panel.
Solution
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
Problem
After I upgraded Ubuntu to 12.04, I also updated mc from source. The current stable version is 4.8.1.3. However, these recent versions of mc introduced some novelties. For instance, using the old mc.ext files, they won’t open archives :(
Solution
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.
mc problem: cannot chmod target file, operation not permitted
Problem
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?
Solution
When you press F5, untick the option “Preserve attributes“. Done.
Install Midnight Commander from source
Problem
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 4.7.5.3 while the PPA contains the version 4.7.0.9 (updated on Sept. 15, 2010).
Solution
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”.
./configuremake- If it was successful then you should have a binary “
mc” file in thesrc/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/mc-wrapper.sh' # new: alias mc='. /usr/local/libexec/mc/mc-wrapper.sh'
Update (20120505)
Installing mc from source is now integrated in jabbatron.
Open Konsole from Nautilus
The following entry is based on the post “Nautilus Script to Launch a Terminal” by Linerd.
Problem
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 :(
Solution
In this post, I found a simple and working solution. Here is the script:
#!/bin/bash
#
# Nautilus script - terminal-here
# This script will open a GNOME Terminal in the current directory.
# Written by Linerd in August, 2009 - http://tuxtweaks.com/
#
# 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
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
######################################################################
if [ "$NAUTILUS_SCRIPT_CURRENT_URI" == "x-nautilus-desktop:///" ]; then
DIR=$HOME"/Desktop"
else
DIR=`echo $NAUTILUS_SCRIPT_CURRENT_URI | sed 's/^file:\/\///' | sed 's/%20/ /g'`
fi
# 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.
Credits
Trouble
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
Problem
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).
View .djvu files
Problem
You want to open .djvu files. Maybe you’d like to convert them in PDF format too.
“DjVu (pronounced like déjà vu) is a computer file format designed primarily to store scanned documents, especially those containing a combination of text, line drawings, and photographs. It uses technologies such as image layer separation of text and background/images, progressive loading, arithmetic coding, and lossy compression for bitonal (monochrome) images. This allows for high-quality, readable images to be stored in a minimum of space, so that they can be made available on the web.” (source)
Solution
The default document viewer of Gnome (evince) can open these files, but it’s quite slow. There is a better program for this format called djview4.
sudo apt-get install djview4
This program can also export .djvu files in PDF format (however, it’ll take some while, the conversion is quite slow).
To open .djvu files with Midnight Commander, add these lines to ~/.mc/bindings:
regex/\.djvu$ Open=djview4 %f &
Configure Midnight Commander to open files with custom application
Problem
You use Midnight Commander (mc) for all your file operations. So far it’s not a problem :) However, when you hit Enter on a file, you would like to set what application mc should use for opening the given file.
For instance, you want to open an .avi file with VLC instead of X player, etc.
Solution
Steps to follow:
cd ~/.mc cp /etc/mc/mc.ext . ln -s mc.ext bindings
That is, copy the global mc.ext to your local .mc directory and put a symbolic link on it called bindings. Now you can start customizing your local mc.ext file.
Don’t forget to restart mc after editing mc.ext!
Examples:
(1) You want to open all your video files with VLC. You also want to add support for .wmv files.
# add these lines
regex/\.([wW][mM][vV])$
Include=video
# modify the include/video section
include/video
#Open=(mplayer %f >/dev/null 2>&1 &) # for mplayer
Open=(vlc %f >/dev/null 2>&1 &) # for VLC
(2) Open .docx files with OpenOffice.org.
# add these lines
regex/\.([Dd][oO][cC][xX])$
Open=(ooffice %f &)
(Thanks for the mc mailing list for their help).
