The operating system Linux has a wide range of text editing programs that can be used by logging into the server via ssh. Among them, there are both simple ones (for example, nano) and complex ones (vim, emacs). Here, the text editor mcedit will be considered, which is installed together with the file manager Midnight Commander. Its name stands for Midnight Commander Editor.
Editor mcedit
To install Midnight Commander, log into the server via SSH using the PuTTY program or the built-in ssh program and execute one of the following commands depending on the distribution. For deb-like:
apt install mc
For rpm-like:
yum install mc
The Midnight Commander program looks as follows. For its usage, look for an article in our blog.
Here you can select the file you want to edit through F4 or create a new one by pressing SHIFT+F4. If several editors are installed in the system, you first need to select the one you will use. Choose mcedit. If another editor is already selected, click with the mouse (or press the F9 button) on the top menu panel Options - Configuration and check the Use internal edit box (with the mouse or the space button) and then at the bottom OK.
The editor can also be launched from the command line. To do this, execute one of the commands:
mcedit
mcedit filename
The program looks as follows:
In the center, there is a large text input field. At the bottom, there is a cheat sheet of possible commands.
At the top, there is a status bar. But if you click on this field with the left mouse button or press the F9 button, the program menu panel will open. This menu is similar to the menu of regular graphical text editors, such as the Notepad program in Windows.
For example, in the Options - General menu, you can enable the Dynamic paragraphing option for word wrapping. Then Options - Save setup to save the settings for subsequent application launches.
The program has all the necessary features for text editing. Help can be obtained by pressing the F1 key. After finishing work with the program, press F2 to save and F10 to exit.
To search, press the F7 key. Enter the word or phrase to search for, as well as parameters such as reverse order search and others. To search for the next occurrence of the word or phrase, press SHIFT+F7.
You can also perform a replace. To do this, place the cursor at the beginning of the document or from the line where you want to start the replacement and press F4. The replacement window will appear:
Then you will have the option to choose: replace, skip, or replace all.
To undo an action, press CTRL+U, to redo - ALT+R.
In the editor, you can also select a text fragment and perform some actions on it. To select a fragment, place the cursor at its beginning and press F3. Move the cursor to the end of the fragment (the 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 selected fragment or F6 to move it (acts as cut and paste).
Conclusion
Thus, we have considered the basic features of the mcedit text editor, with which you can create and edit files on servers with Linux operating systems.