svg
Post Image

Vi Editor – Basics

Working in an environment requires at some point handling documents, reading it, searching, changing content, removing content and saving it. In DevOps, or System Administration you may need to work with Linux and use the terminal to change configurations, for that you need an editor.

In this article you will learn how to use Vi editor to interact with documents.

Vi Modes

In Vi you have two modes of interaction:
– Command mode
– Insert mode

To enter insert mode you need to press the key “i”. To enter the command mode you need to press the “esc” key.

Basic Commands

Use “x” to delete chars.

Use “dd” to delete an entire line.

To copy a line you use “yy” and to paste it use “p”.

To scroll up you use “CRTL + u” to scroll down you use “CTRL + d”.

To save a file you use “:w” or “:w filename”.

To discard changes “:q”.

To write and close “:wq”.

To find occurrences you use “/<word>” and you press “n” to iterate to each occurrence.

Conclusion

This will help you get more freedom while working with documents while operating on the terminal.

svgLinux : Bash basics
svg
svgPackage Manager

Leave a reply