Editor Alternatives

If you don’t like Vim as an editor feel free to use Nano or Midnight Commander (mc) in the SSH terminal. Here is a quick introduction to both. And no, I’ll refuse to talk about Emacs…​ ;-)

Midnight Commander (mc)

Mc is more then an editor, it’s a file manager. And it has this nice nineties feel about it…​ anyway we’ll focus on editing files here.

To open mc at the commandline prompt type:

# mc

Basic Editing

Mc is controlled mainly through the function keys. This can pose all kinds of issues when run in a terminal session, e.g. F10 is most times caught as a shortcut by the terminal window.

To work around this:

To create a new file:

To save a file:

To exit edit mode with or without saving:

Copy text internally:

Paste text internally:

Copy text from external source:

Paste text from external source:

Short Intro to the Nano Editor

If you don’t like Vim and you feel too young for Midnight Commander use Nano, a simple to use command line editor.

Basic Commands

Tip

Ctrl-<n> or Alt-<n> means press and hold the Control or Alt key and then press the character after the dash.

To create a new file or open an existing file:

# nano playbook.yml

Tip

When Nano asks for confirmation, it expects a y for yes or n for no.

To save the current file in Nano:

Tip

Depending if the file was changed or not Nano will ask for confirmation and the file name.

To leave Nano without saving the file (if something went wrong while editing and you just want out without changing anything):

Copy and paste external text:


Click here to return to the Ansible for Red Hat Enterprise Linux Workshop