We have moved to www.dataGenX.net, Keep Learning with us.

Saturday, October 11, 2014

Cut, Copy n Paste in VI editor


We Engineers are well trained in Cut, Copy and Paste things :-) and who the hell don't know the Ctrl-X, C n V. But when we come to same but in Linux Platform we are behaving like dumb ;P. Don't feel offended...I'll help u here

So Lets learn some command which can do the same in Linux VI editor --

Cut - Ctrl-X

The command 'dd' is used for cutting text. Cutting current word, lines or many more summarized below -

dd Delete current line D Delete from cursor to end of line
d$ Delete from cursor to end of line
d0 Delete from cursor to beginning of line
dw Delete from cursor to end of current word
db Delete from cursor to beginning of current word
Ndd Delete N no of lines including current line



Copy - Ctrl-C

Command 'yy' is used for copying the text.

yy Copy current line Copy from cursor to end of line
y$ Copy from cursor to end of line
y0 Copy from cursor to beginning of line
yw Copy from cursor to end of current word
Nyy Copy N no of lines including current line

Paste - Ctrl-V

Command 'p' is used for paste the copied or cut text. When we are copying or cutting text in VI, it went to buffer and available till next Copy(yy) or Cut(dd) command.

p Paste the buffer after the cursor
P Paste the buffer before the cursor


All command will work only in Vi 'Command' mode. You can go to 'Command' mode by using Escape key.


Like the Facebook Page & join Group
https://www.facebook.com/DataStage4you
https://www.facebook.com/groups/DataStage4you

https://twitter.com/datastage4you
For WHATSAPP group , drop a msg to 91-88-00-906098


No comments :

Post a Comment