TechLife Australia

Manage files and more

Midnight Commander can do more than just copy, move or delete files. Some would argue that it’s as versatile as Shashank Sharma.

-

As we’re celebratin­g 30 years of the Linux kernel, we’ve decided to focus on a wonderful command-line project that’s been around for nearly as long. Midnight Commander is an orthodox file manager that features a split-pane interface and is one of the oldest file managers that’s still being actively developed. Currently under the GPLv3+ license, Midnight Commander is part of the GNU project. First released in 1994, Midnight Commander quickly became a favourite of most of the Linux crowd. Despite its soaring popularity, with the ever-increasing focus on GUI applicatio­ns in the late 90s to early 2000s, Midnight Commander slowly fell away by the wayside.

This explains why none of the popular desktop distributi­ons offer it as part of the default installati­on. And yet, you can gauge the continuing popularity of the applicatio­n from the simple fact that all distributi­ons feature it in their software repositori­es, making it a breeze to install.

If you’re on a Debian/Ubuntu based distributi­on, you can run the SUDO APT INSTALL MC command to install it. You can similarly use the SUDO DNF INSTALL MC command to install Midnight Commander on RPM-based distributi­ons such as Fedora.

Navigating the MC interface

Once installed, you can run

Midnight Commander with the mc command. Midnight Commander defaults to a colour mode, but the default coloursche­me might not appeal to everyone. If you find the use of blue and green unpalatabl­e, you can invoke Midnight Commander without colours using the MC -B command. Run the MC --HELP-COLORS command for more informatio­n on the supported colour schemes and how to switch between them.

Although Midnight Commander is a text utility, it has full mouse support, which means that you can left-click to select different files, or even access the different menus at the top of the interface.

The interface is split into two panes and you can move between the panes by pressing the Tab key. You’ll also find a menu bar at the top of the interface. The File and Command menus comprise various entries to help you perform a number of different operations such as copy or rename a file, change its attributes and find or compare files.

Each pane displays the current directory at the top-left. The panes list the directorie­s at the

top, followed by files within the current directory and all hidden files are displayed by default. If you wish to sort the files, whether by extension, size, file name, modify time and so on, or switch the display to tree view, for example, then you can do so from under the Left or Right menu, which govern the behaviour of the two panes.

At the bottom of the interface is a strip comprising a series of actions, such as Help, Menu, Copy, Edit, Mkdir and Delete. Each of these actions is preceded by a number from 1-10. For instance, View is preceded by 3, while Deleted is preceded by 8. These number denote the Function keys on the keyboard. So, if you want to quit Midnight Commander, you can press F10. To delete the selected file, press F8. You can similarly press F3 to view a selected file.

You can use the scroll-wheel on your mouse or the up/down arrow keys to move though the contents of the current directory. Use left-click to select a file, or press the Insert key, which can also be used to select multiple files. To unselect a file, move to the file using the arrow keys, and press Insert key again to unselect it.

Unlike graphical file manager, Midnight Commander lacks the ability to drag files between directorie­s. You must first select the file, and then choose an operation from the File or Command menu, or one of the actions at the bottom of the interface.

You can press the F9 key to select the top menu, and then use the arrow keys to navigate to the menu and its entries or press

Alt- first letter key combinatio­n. For instance. To open the Command menu, you can press F9 followed by Alt-C.

File operations

A file manager can be used to perform a variety of functions, such as copying or moving files, changing file permission­s, viewing the contents of compressed files, or even compressin­g or uncompress­ing archives.

You can perform all these operations, and more, with Midnight Commander. It even supports viewing the contents of text and PDF files, and show you the contents of compressed archives without first uncompress­ing them. Even better, you can also edit text files using the default editor.

Due to space constraint­s, we can’t cover each of these operations in detail, but it’s so intuitive that you’ll be able to figure it out in almost no time at all.

If you wish to compress a number of files, first select them using the Insert key. Now, press F2 to open the User Menu. You’re presented with a number of choices, and for each choice there’s a correspond­ing keyboard shortcut. With time, you’ll be able to straight away use these shortcuts without having to read the different functions they perform.

Select the first option, ‘Do something on the tagged files’, which open the command dialog. You can now enter the command you wish to run to create the compressed archive of the selected file. For instance, run the TAR -CZVF TARBALL.TAR.GZ %S command to create a tar.gz compressed archive containing all the selected files. The %S parameter ensures that all selected files are added to the archive.

In fact, the main Midnight Commander interface also features a shell prompt at the bottom. It’s enabled by default, and can be used to perform the same operation without using any menus. You can run any commands on the selected files using this command prompt.

Instead of setting the two panes to display different directorie­s on the local machine, you can also use Midnight Commander to connect to a remote machine via FTP. Press

F9, select the pane you wish to display the remote machine (Left or Right) and then select FTP.

There’s plenty more that you can do with Midnight Commander, and while much has been written about this great utility, there just isn’t any official documentat­ion. The man pages and the MC --HELP command are the extent of documentat­ion, although the project claims that it’s working to improve things on this front. Refer to the man page for quick introducti­on to keyboard shortcuts that can help you quickly access commonly used operations such as copy and move.

 ??  ?? Apart from running chown and chmod operations with mc, you can use the Advanced Chown feature, which combines both functions.
Apart from running chown and chmod operations with mc, you can use the Advanced Chown feature, which combines both functions.
 ??  ?? You can use the Options menu at the top to switch from a vertical split to horizontal, and tweak a number of other settings.
You can use the Options menu at the top to switch from a vertical split to horizontal, and tweak a number of other settings.

Newspapers in English

Newspapers from Australia