SDB:Midnight Commander tips
Tips and tricks edit
Using the mouse
Although Midnight Commander is a text mode application it can make use of mouse. The openSUSE delivered mc will make use of the mouse when used with a GUI console, without any further configuration needed.
The text mode terminal that we get when booting in runlevels 2 or 3 is a bit different story. You have to install the package gpm ("general purpose mouse") which is also called mouse server. The gpm is used in Linux to receive movements and clicks from mouse. Start gpm and then start Midnight commander.
If you come to the text terminal using Ctrl + Alt + F1, then gpm will not work as another driver that belongs to GUI (X Server) claims control over the mouse.
Lynx like motion
This is browsing using the cursor keys. You have never seen graphical applications (like Konqueror) run this fast through directories.
openSUSE 11.4 and later
Main difference to older versions of Midnight Commander is different menu, so now we need Panel options instead of Configuration.
To enable it
- Press F9 to select drop down menus on the top of the screen.
- Press Alt + o or move highlight with cursor keys for left or right to the Options, then press arrow down, to get drop down menu with options.
- Press arrow down to select Panel options and Enter key to open window with setup
- Press arrow down until you have selected [ ] Lynx-like motion, or , or ALT + y to jump directly.
- Press Space to check option. It will show [x] Lynx-like motion if it is active (enabled)
- Press Alt + s or move highlight to the [ Save ] and press Enter to save setting.
openSUSE 11.3 and earlier
To enable it
- Press F9 to select drop down menus on the top of the screen.
- Press Alt + o or move highlight with cursor keys for left or right to the Options, then press arrow down, to get drop down menu with options.
- Press Alt + c or Enter to get dialog window Configuration with options.
- Now don't use key shortcut, but use cursor key to move highlight to [ ] Lynx-like motion option,
- Press Space to check option. It will show [x] Lynx-like motion if it is active (enabled)
- Press Alt + s or move highlight to the [ Save ] and press Enter to save setting.
Happy browsing.
FTP browsing
This is file browsing on remote FTP server just as it is on your computer.
- Press F9 to select drop down menus on the top of the screen.
- Press Alt + L if you want to use left side panel, or Alt + R for right panel.
- Press Alt + P for input box where you have enter server name. Enter for instance
ftp.gwdg.de/pub
and press Enter.
Now mc will try anonymous connection to remote machine. If machine responds, you'll get directory listing of /pub on remote server.
It is possible to do the same from mc command line by typing:
cd /#ftp:ftp.gwdg.de/pub
Happy browsing.
Archive browsing
Archive in classic meaning is compressed file. In Linux you can recognize them by suffix like:
tgz, tar.gz, tbz, tar.bz2
and many more, but above few are the most used
- Highlight the file
- Press Enter
That's it. Midnight Commander will decompress file for you and present it's internal structure like any other directory. If you want to extract one or all files from archive mark what you want toextract and use F5 to copy in another panel. Done.
RPM browsing
The package installation files for any SUSE are RPM and mc will let you browse them.
- Highlight the file
- Press Enter
You'll see few files:
/INFO CONTENTS.cpio HEADER *INSTALL *UPGRADE
Browse to see details of your RPM.
The CONTENTS.cpio is actual archive with files, and if you want to see within:
- Highlight the file
- Press Enter
(You know the drill)
The *INSTALL and *UPGRADE will do what the name tells, but if you want only to extract one or more files from CONTENTS.cpio than use F5 to copy them in the directory in the other panel.
PuTTY and line drawing
PuTTY is terminal application used to access remote computers running Linux via ssh (SSH tunnels from Microsoft Windows see details). The line drawing in Midnight Commander, YaST and another applications that draw lines using special characters can be displayed wrong as something else. The solution is to change settings:
- menu: Window > Translation:
- Received data assumed to be in which character set: UTF-8
- Handling of line drawing characters: Use Unicode for line drawing
If that doesn't help, you may set this too:
- menu: Connection > Connection-type string: linux
- menu: Terminal > Keyboard > The Function keys and keypad: Linux
Found on webmilhouse.com.
Diffs in color
Tip by James Ogley:
+ t r & ! t t d Diff against file of same name in other directory if [ "%d" = "%D" ]; then echo "The two directores must be different" exit 1 fi if [ -f %D/%f ]; then # if two of them, then diff -up %f %D/%f | sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \ -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \ -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g' | less -R else echo %f: No copy in %D/%f fi D Diff current directory against other directory if [ "%d" = "%D" ]; then echo "The two directores must be different" exit 1 fi diff -up %d %D | sed -e 's/\(^-.*\)/\x1b[1;31m\1\x1b[0m/g' \ -e 's/\(^\+.*\)/\x1b[1;32m\1\x1b[0m/g' \ -e 's/\(^@.*\)/\x1b[36m\1\x1b[0m/g' | less -R fi
Here is place for your tips.
Help
For any question that has to be answered ASAP, Midnight Commander has built in online help. Press F1 and you'll see.
Related:
All of SDB: