Organizational Research By

Surprising Reserch Topic

Question:vi editor:how to use sed vi command on command line?


Vi is a great text editor. People will argue that emacs is a better option or that pico is easier, but I find that vi is a great solution for doing quick text modifications. Emacs is the big mature Unix editor and pico is a little too simple, so I use vi most of the time because it offers a lot of solid features without a huge learning curve. After reading this article you should read more about vi.

Start vi with a new or existing filename:

vi filename.php

You’re now in the editor. Within the editor are two modes: command and insert. To enter command mode at any point hit the ‘ESC’ key. Most commands are prefixed with a colon ‘:’ so to quit out of the program enter command mode and type ‘:q’ (without quotes) followed by the ‘Return’ key. Fire up vi again and, this time, go into insert mode by pressing the ‘a’ key. You can start typing whatever you need just like in any other text editor. To save and quit hit the ‘ESC’ key to enter command mode and type ‘:wq’. The ‘w’ means write the file and ‘q’ means quit vi. If you wanted to quit and not save your changes you could type ‘:q!’ in command mode. There are hundreds and hundreds of good keyboard shortcuts to use while in command and insert mode and you can read about them in the article I linked to above.

asked Sep 13, 2013 in LINUX by anonymous
edited Sep 12, 2013
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.