Linux vi Text Editor command help

The vi command in Linux provides the most basic of text editing capabilities from the command line. It is both useful and at the same time extremely clunky without the proper command knowledge. Most of my searching on the web has resulted in many pages assuming that if you know the vi command then you must also know how to use it… I Linux therefore I am, or some such.

However to someone that generally doesn’t need to use the editor that often it can be frustrating trying to make a single character change in a file only accessible via SSH without having to copy the file to a desktop machine, change and copy back. Luckily I have found the following command cheatsheet for the editor:

ctrl-F :Page downctrl-B :Page up$ :Move cursor to end of line^ :Move cursor to beginning of line:1 :Move to first line of file:$ :Move to last line of file/ :Search for a character string? :Reverse search for a character stringx :Delete the character at the cursordd :Delete the current linep :Paste data that was cut with x or dd commandsu :Undo

a :Add text after cursori :Insert text before cursorR :Replace text starting at the cursoro :Insert a new line after the current

esc :Switch from Input mode to Command mode

:w :save without exitingZZ :Save and exit:q! :Exit without saving

So far this small but concise list has proved extremely helpful, all of a sudden the linux vi editor has become a very handy tool to have.

This website uses cookies to help provide visitors to our site with the best user experience possible. Click the 'I Accept' button to acknowledge you understand our cookie policy and are happy for our site to place cookies on your computer. View our Cookie Policy