To install Midnight Commander, log in to the server via SSH using the PuTTY program or the built-in ssh program and run one of the following commands, depending on the distribution. For deb-like ones:
apt install mc
For rpm-like ones:
yum install mc
The Midnight Commander program looks like this. For its use, look for an article on our blog.
Image 1. Appearance of the program Midnight Commander
Here you can select the file you want to edit or create a new one by pressing SHIFT+F4. If several editors are installed on the system, you first need to select the one that you will use. Select mcedit. If another editor is already selected, click using the mouse (or F9 button) in the top menu bar Options - Configuration and check Use internal edit (with the mouse or the spacebar) and then OK at the bottom.
The editor can also be launched from the command line. To do this, run one of the commands:
mcedit mcedit filename
The program looks like this:
Image 2. Appearance of the text editor mcedit
In the center is a large field for entering text. Below is a cheat sheet of possible commands.
At the top is the status bar. But if you click on this field with the left mouse button or press the F9 button, the program menu bar will open. This menu is similar to that of conventional graphical text editors such as Notepad in Windows.
So, for example, in the Options - General menu, you can enable the Dynamic paragraphing option for word wrapping. Then Options - Save setupto save the settings for the next launches of the application.
Image 4. The main settings window of the mcedit editor
The program has all the necessary features for editing texts. Help is available by pressing the F1 key. When finished working with the program, press F2 - save and F10 - exit.
Press F7 to search. Enter a word or phrase to search, as well as options such as reverse search and others. To search for the next occurrence of a word or phrase, press SHIFT+F7.
You can also make a replace action. To do this, place the cursor at the beginning of the document or from the line from which you want to start replacing and press F4. The replacement window will appear:
You will then be able to choose to replace, skip, or replace all.
To undo the action, press the combination CTRL+U, to redo press ALT+R.
In the editor, you can also select a piece of text and perform some actions on it. To select a fragment, place the cursor on its beginning and press F3. Move the cursor to the end of the fragment (next after the last selected character) and press F3 again. Then place the cursor in the desired position in the document and press F5 to copy the selection or F6 to move it (acts like cut and paste).