vi editor basics

following are the basic things which you should know regarding vi editor

1. we use vi editor to edit/create files using terminal window

2. syntax :
vi <filename>
explanation : if <filename> does not exist, it will create that file and if it does exist, then it will open that file for editing

3. there are two modes in vi editor
a. command mode
b. insert mode

4. as soon as you open file in vi editor, it will open it in command mode by default.

5. press i for going from command mode to insert mode

6. press esc for going from insert mode to command mode

7. press esc:wq to save file and exit vi editor

8. press esc:q! to exit vi editor without saving

9. press / and then type word to search for a particular word in the file

10. following is the pattern in which find and replace works in vi editor. press :s/<pattern_to_search>/<pattern_to_replace>/

 

 

Published by milindjagre

I founded my blog www.milindjagre.co four years ago and am currently working as a Data Scientist Analyst at the Ford Motor Company. I graduated from the University of Connecticut pursuing Master of Science in Business Analytics and Project Management. I am working hard and learning a lot of new things in the field of Data Science. I am a strong believer of constant and directional efforts keeping the teamwork at the highest priority. Please reach out to me at milindjagre@gmail.com for further information. Cheers!

2 thoughts on “vi editor basics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: