Professional Documents
Culture Documents
Session-1
A. Log into the system
B. Use ‘VI” editor to create a file called myfile.txt which contains some text.
C. Correct typing errors during creation
D. Save the file
E. Logout of the system
b. Use vi editor to create a file called myfile.txt which contains some text
Syntax:-vi file name
Description:
Vi Command is used to create and editing a file;
If we type "vi filename".
If the file named filename exists, then the first page (or screen) of the file will be
displayed;
If the file does not exist, then an empty file and screen are created into which you may
enter text.
Example: vi myfile.text.
bphanikrishna.wordpress.com
FOSS-LAB Page 1 of 3
CSE (R13@II.B-Tech II-Sem) EXP-1
Session-2
A. Log into the system
B. Open the file created in session-1.
C. Add some text
D. Change some text
E. Delete some text.
F. Save the file
G. Logout of the system
bphanikrishna.wordpress.com
FOSS-LAB Page 2 of 3
CSE (R13@II.B-Tech II-Sem) EXP-1
d. Changing Text
To change the some text in myfile. text move the cursor where we want to change the text
After that replace the text under cursor with other text first open the file as follows.
vi myfile.text
The following commands allow you to modify text.
r:- replace single character under cursor (no <Esc> needed)
R:- replace characters, starting with current cursor position, until <Esc> hit
cw:- change the current word with new text, starting with the character under cursor,
until <Esc> hit
cNw:-change N words beginning with character under cursor, until <Esc> hit;
e.g., c5w changes 5 words
C:- change (replace) the characters in the current line, until <Esc> hit
cc:- change (replace) the entire current line, stopping when <Esc> is hit
Ncc or cNc:-change (replace) the next N lines, starting with the current line, stopping
when <Esc> is hit
bphanikrishna.wordpress.com
FOSS-LAB Page 3 of 3