Linux Tricks and Techniques

For Linux Experts

Use the website for easy leaning of Linux

Wednesday, 8 June 2016

Vi Editor in Linux

How to work with vi editor in Linux

In linux we need to make files to work as we do in window but to type text in that file we have to use vi editor which works in a different way. We need to use some keys to press to start work with the vi editor and the save file method is also different. To create a file in linux we can use the below commands:

# touch filename

# vi filename

# mkfile filename

To write data in these files we use vi text editor. some useful commands of vi editor are given below:

# vi file will open a blank screen to start writing in this file Press ESC key and i.



a - append the text after the cursor

i-  insert text before cursor

A- insert the text at the end of line

I- start writing at the beginning of line

o- open a new line below the cursor

O- insert the new line above the cursor

h- left one character

w- forward one word wise

b- backward one word

e- to the end of the current word

$- end of the line

0- to the beginning of the line

G- goes to the last line

1G- goes to first line

x- delete one character

dw- delete one word

dd- delete one line

D- delete all at the right of cursor

yy- copy a line

p- paste a line

:wq!- to save file

:q- quit without save

:/- to search content in file


No comments:
Write comments