Outils pour utilisateurs

Outils du site


issue98:labolinux_-_midnight_commander

Ceci est une ancienne révision du document !


Table des matières

1

Several years ago, a friend started talking about the importance of search and how searching was going to change the way we use computers. I listened intently, but, coming from a DOS (Disk Operating System) background, something felt inherently wrong with the conversation. I've always been a fan of file structure, and having a mess of files that you search just didn't feel right. My friend was correct, search has greatly changed the way we use computers. Desktop search arrived in a big way across many operating systems. Initially, when search was implemented, indexing ate a large amount of CPU cycles so computers with search enabled were slow. As the cost of powerful processors, big RAM, and big hard drives came down, search became a more viable tool. As useful as search is, file management is fundamentally important. When search fails to find a file, structure is important. Just the other day a family member came to me with a cellphone problem. The problem she was experiencing was that she couldn't view any of the videos or pictures sent via Whatsapp to her phone. The real problem was that the phone's internal storage was full and she had no idea how to fix the problem. The family member had even opened the file management tool on her phone, but did not know she could move files off the internal storage on to an external microSD card. Because the Android OS tends to be laid out in a particular way, it was simple enough to use the file manager to go in and delete unnecessary files.

Il y a plusieurs années, un ami a commencé à parler de l'importance des recherches (search) et de comment les recherches allaient changer notre façon d'utiliser des ordinateurs. Je l'ai écouté attentivement, mais, étant donné ma formation DOS (Disk Operating System ou système d'exploitation des disques), il y avait quelque chose dans la conversation qui semblait clocher de façon intrinsèque. J'ai toujours apprécié la structure des fichiers et l'idée d'avoir un gros tas de fichiers dans lesquels vous faites des recherches, me mettait tout simplement mal à l'aise.

Mon ami avait raison, search - les recherches - ont vraiment changé notre façon d'utiliser des ordinateurs. Les moteurs de recherche de bureau ont pénétré en force sur beaucoup de systèmes d'exploitation. Au départ, quand search fut implémenté, l'indexation utilisait un nombre énorme de cycles du processeur ; ainsi, les ordinateurs sur lequel search était activé étaient lent. La baisse des prix de processeurs puissants, de la RAM et de gros disques durs a fait que search est devenu un outil viable. Aussi utile que puisse être search, la gestion des fichiers est extrêmement important. Quand search n'arrive pas à trouver un fichier, la structure est important.

L'autre jour un membre de ma famille est venu me voir avec un problème de téléphone mobile. Selon elle, le problème était qu'elle n'arrivait à afficher aucune des vidéos ou photos envoyées sur son téléphone via Whatsapp. Le véritable problème était qu'il ne restait plus de place dans le stockage interne du téléphone et elle n'avait aucune idée de comment le corriger. Elle avait même lancé le gestionnaire de fichiers du téléphone, mais ne savait pas qu'elle pouvait déplacer les fichiers du stockage interne vers une carte microSD externe. Puisque la structure de l'OS Android a tendance à être spécifique à ce système, c'était assez simple d'utiliser le gestionnaire de fichiers pour accéder au stockage et supprimer des fichiers inutiles.

2

That long-winded introduction brings me to my favourite file management tool, Midnight Commander (mc). Midnight Commander is a text-based orthodox file manager that looks and mirrors a lot of the functionality of the DOS tool Norton Commander written almost 29 years ago by John Socha and released by Peter Norton. Orthodox file managers have three panels, two top panels for graphical file management, and a command-line panel at the bottom. One of the things I like about Midnight Commander is the fact that it gives you a graphical-like interface on top of a text-based shell so it can be used on systems without a desktop interface (GUI). Midnight Commander isn't installed on Ubuntu by default to you'll have to install it, but the package name is easy to remember: mc. sudo apt-get install mc Basic Usage On Ubuntu, Midnight Commander is mouse aware so you can just click on the top menu options: Left, File, Command, Options and Right. To access the menu in a text-only session, simply press the F9 key. The Left and Right menu options are identical and the actions work in each of the left and right shells.

Cette introduction interminable m'amène au gestionnaire de fichiers qui je préfère, Midnight Commander (mc). Midnight Commander est un gestionnaire de fichiers orthodoxe et textuel qui ressemble à, et reflète pas mal des fonctionnalités de, l'outil DOS, Norton Commander écrit il y a presque 29 ans par John Socha et publié par Peter Norton.

Des gestionnaires de fichiers orthodoxe ont trois volets, deux volets en haut pour une gestion par interface graphique, et un volet en ligne de commande en bas. Une des choses qui me plaisent dans Midnight Commander est qu'il vous donne une interface quasi graphique au-dessus d'un shell textuel et peut donc être utilisé sur des systèmes sans bureau en interface graphique (GUI).

Midnight Commander n'est pas installé par défaut sur Ubuntu et vous aurez donc à l'installer, mais il est facile de se souvenir du nom du paquet : mc.

sudo apt-get install mc

Utilisation de base

Sous Ubuntu, Midnight Commander reconnaît la souris ; ainsi, vous pouvez tout simplement cliquer sur les options du menu en haut : Left (gauche), File (fichier), Command, Options et Right (droite). Pour accéder au menu dans une session textuelle, il suffit d'appuyer sur la touche F9. Les options menu Left et Right sont identiques et les actions fonctionnent dans chacun des deux shells (gauche et droit).

3

To switch between left and right panels, press the tab key. The insert key is used to select/mark files. Marked files change colour to yellow (in the default mc colour scheme; it’s possible to change colour schemes). To select all files in a folder press + (which is usually shift = on most keyboards) then use * to select all files. Pressing - will do the opposite. Pressing the Enter key while on top of a compressed file will attempt to view the contents of the compressed file (zip/gz for example). The F5 key copies marked files from one panel to another while F6 moves the files. If you don’t have any files marked, F5 and F6 will copy/move the file that is currently selected (reversed background). To create a new directory press the F7 key. F8 deletes the marked files or the currently selected file. Lastly, the F4 key will edit whatever text file you’re hovering over (letting you chose from ed, nano, mcedit or vim.tiny). Among the more useful options in the left and right menus are the listing mode, sort order and ftp/sftp links. Listing mode has several options: full file list, brief file list, long file list and user defined list. Full file list is the default mode in Midnight Commander. On the leftmost column are the files and directories, the next column shows the file size followed by the file's modified time. Midnight Commander has a lot of sorting options: unsorted, name, version, extension, size, modify time, access time, change time, or inode. These options can be further modified by setting executable first, case sensitive or reverse. I frequently sort by extension so I can easily mark (the insert key) similar files for deletion (F8).

4

At the top of each panel are a less-than symbol < and a caret ^ symbol. Clicking on the caret ^ symbol brings up a short history file of the paths you’ve entered. Beside the less-than symbol is the current path you’re in. In the example below, the path on the left pane is ~/Downloads and in the right I’m connected to a machine called xbmc as the xbmc username in the /home folder. Midnight Commander makes it easy to sftp (secure ftp) files to a server. Simply click the Left or Right menu option and select SFTP link. You’ll be asked to enter the machine name. If you’re connected to a machine where you use a different username be sure to include it before an @ symbol. So, in the example above: xbmc@xbmc where xbmc is the username and the machine name. If my username on the machine we were sshing into was charles, it would be charles@xbmc. Midnight Commander will ask for the password and mount the remote machine’s mount point. You can also type sftp username@machinename into the third panel at the bottom of midnight commander, but rather than mounting a folder in one of the panels it just runs a regular interactive sftp session.

5

If you’re a fan of skinning and don’t like Midnight Commander’s default colours, mc can be skinned. Unfortunately, some of the documentation I found on skinning Midnight Commander simply didn’t work (editing the ~/.mc/ini file). This might stem from the fact that the Midnight Commander trac page hasn’t been edited in over 6 years. What worked for me was following the steps outlined by Zoltan Puskas on his blog: https://sinustrom.info/2014/03/23/midnight-commander-dark-color-scheme/ These steps involve putting a named.ini file in ~/.local/share/mc/skins, then setting that named.ini file in ~/.config/mc/ini (minus the ini) where the variable name is skin. An example: skin=named The named.ini file consists of a variety of [sections] that define the skin name, the lines look, the look for the core, dialog box, error, file highlight, menu, help, editor, viewer, and a slew of other options. I’ve only covered some of the basics of what Midnight Commander can do. MC can undelete files (command menu), compare files and directories, view file details, change permissions and ownership on files, and a lot more. If you’re in that spot where you like graphical user interfaces, but also like the speed the console affords, Midnight Commander is an awesome tool.

issue98/labolinux_-_midnight_commander.1436448380.txt.gz · Dernière modification : 2015/07/09 15:26 de auntiee