Vi Editor Unix Commands for BASIS Admins


vi command launches a visual editor. To edit a file type

vi filename
vi editor is a default editor of all Unix systems. It has several modes. In order to write characters you will need to hit i to be in insert mode and then start typing. Make sure that your terminal has correct settings, vt100 emulation works good if you are logged in using pc.

Once you are done typing then to be in command mode where you can write/search/ you need to hit :w filename to write
and in case you are done writing and want to exit
:w! will write and exit.

options: 


I inserts text at the curson
A appends text at the end of the line.
a appends text after cursor.
O open a new line of text above the curson.
o open a new line of text below the curson.
: for command mode.
<escape> to invoke command mode from insert mode.
:!sh to run unix commands.
x to delete a single character.
dd to delete an entire line
ndd to delete n number of lines.
d$ to delete from cursor to end of line.
yy to copy a line to buffer.
P to paste text from buffer.
nyy copy n number of lines to buffer.
:%s/stringA/stringb /g to replace stringA with stringB in whole file.
G to go to last line in file.
1G to go to the first line in file.
w to move forward to next word.
b to move backwards to next word.
$ to move to the end of line.
J join a line with the one below it.
/string to search string in file.
n to search for next occurence of string.

Tags: Vi Editor Unix Commands for BASIS Administrators
Share this article :

Post a Comment

 
Copyright © 2011. SAP BASIS ANSWERS | SAP BASIS ADMIN BLOG - All Rights Reserved
T C P M
Proudly powered by Blogger