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 (for example, nano) and complex (vim, emacs). Here we will consider the text editor mcedit, which is installed along with the file manager Midnight Commander. Its name stands for Midnight Commander Editor.
What is the mcedit editor?
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-based:
apt install mc
For rpm-based:
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 by pressing F4 or create a new one by pressing SHIFT+F4. If multiple editors are installed on 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 F9) in the top menu bar Options - Configuration and check Use internal edit (with the mouse or by pressing space) and then at the bottom OK.
How to launch the editor 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 area. At the bottom - a cheat sheet of possible commands.
At the top is the status bar. But if you click on this area with the left mouse button or press the F9 key, the program's menu panel will open. This menu is similar to the menus of regular graphical text editors, for example, 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 launches of the application.
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, as well as parameters such as searching in reverse order and others. To search for the next occurrence of the word or phrase, press SHIFT+F7.
You can also perform replacement. 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. A replacement window will appear:
Then you will have the option to choose: replace, skip, or replace all.
To undo an action, press the combination CTRL+U, to redo - ALT+R.
In the editor, you can also highlight a fragment of text and perform some actions on it. To highlight a fragment, place the cursor at its beginning and press F3. Move the cursor to the end of the fragment (the next character after the last highlighted character) and press F3 again. Then place the cursor in the desired position in the document and press F5 to copy the highlighted fragment or F6 to move it (acts like cut and paste).
Conclusion
Thus, we have reviewed the basic capabilities of the mcedit text editor, which allows you to create and edit files on Linux servers with Linux family operating systems.
We also suggest considering other useful articles:
- File manager Midnight Commander
- Dockerfile: A complete guide for beginners and professionals
- How to connect to a Docker container via sFTP