Edit: Did you know you could do this?
Originally posted April 7, 2015 on AIXchange
It’s easy to overlook the simple things. For instance, did you know that vi can be invoked from within the more command?
From “man more”:
The more command uses the following subcommands:
h Displays a help screen that describes the more subcommands.
v Starts the vi editor, editing the current file in the current line.
To try this out, run:
‘more /etc/hosts’
Then from inside your more session, type v and you will go into vi. By typing vi, you’re actually inside vi in editing mode.
Once you modify the file and save your changes, exit out to return to your more session and verify that your changes were made.
Be sure to look at some of the other options available in more, such as how to get to the very end or very beginning of a file, or how to skip ahead a particular number of lines.
While we’re on the subject, here’s a reminder for newer AIX administrators: “set –o vi” gives you easy access to your shell history, along with command completion and other capabilities.
I could go on about the usefulness of vi, but why not get a vi cheat sheet and see for yourself? I’ll list a couple (here and here), but there are many more online. Just search on “vi cheat sheet” and look at the image results.