You are on page 1of 3

CSE (R13@II.

B-Tech II-Sem) EXP-1

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

a. Log into the system


When we return on the system one screen will appear. In this we have to type 100.0.0.9 then
we enter into editor. It asks our details such as
Login : krishnasai
password:
Then we get log into the commands.

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.

c. Correct typing errors during creation


In creating a file through vi editor an error an error will occur we modify the file by opening
the file again. An error will occur when we don’t give space between filename and command
name
Example: vikrishnasai

Save the File.


To save the file created in vi editor we press esc “:WQ” .It means that saves the file and
Quits editing mode .then we come out from the vi editor.
:wq:- quit vi, writing out modified file to file named in original invocation
:q!:- quit vi even though latest changes have not been saved for this vi call
:x:- quit vi, writing out modified file to file named in original invocation

Logout the system.


Syntax: exit
Description: In our current directory press exit to log out from the commands

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

a. Log into the system


When we return on the system one screen will appear. In this we have to type 100.0.0.9 then
we enter into editor. It asks our details such as
Login : krishnasai
password:
Then we get log into the commands.

b. Open the file created in session -1


Syntax: vi filename
In the above session we create a file in vi editor To open the file created in Session 1 we
have to type as follows “vi filename”

c. Add Some text:


To add some text to the file which is already created first we have to open that file then add
text.
vi filename. Text
The following commands allow you to insert and add text. Each of these commands puts the
vi editor into insert mode; thus, the <Esc> key must be pressed to terminate the entry of text
and to put the vi editor back into command mode.

 i:- insert text before cursor, until <Esc> hit


 I:- insert text at beginning of current line, until <Esc> hit
 a:- append text after cursor, until <Esc> hit
 A:- append text to end of current line, until <Esc> hit
 o:- open and put text in a new line below current line, until <Esc> hit
 O:- open and put text in a new line above current line, until <Esc> hit

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

e. Delete some text


To delete text in my file text we first move the cursor to end of that line and then press delete
then the line is erased to do this first we open the file as
vi myfile.text
The following commands allow you to delete text.
 x:- delete single character under cursor
 Nx:- delete N characters, starting with character under cursor
 dw:- delete the single word beginning with character under cursor
 dNw:-delete N words beginning with character under cursor;
 e.g., d5w deletes 5 words
 D:- delete the remainder of the line, starting with current cursor position
 dd:- delete entire current line
 Ndd or dNd:-delete N lines, beginning with the current line; e.g., 5dd deletes 5 lines

f. Save the changes:


To save the changes made in file myfile.text we press
esc:WQ
It means that saves the file and quits editing mode then we log out from the vi Mode.

Logout the system.


Syntax: exit
Description: In our current directory press exit to log out from the commands

bphanikrishna.wordpress.com
FOSS-LAB Page 3 of 3

You might also like