Home » , , » Step by Step Guide of vi Editor how to use switches options descriptions

Step by Step Guide of vi Editor how to use switches options descriptions

Written By 1 on Saturday, February 5, 2011 | 1:05 PM

In our last assignment your learnt about cat command. cat is a very basic command you cannot depend on cat command in exam to create files as cat is a very essential command. In cat you can neither see the matter of file nor modify the material. In this assignment we are going to use world's most powerful editor vi.
Before we go further just learn how to create a hidden file in linux and see it.

$cat > [.name of file]
A single dot in front of the file will make it hidden. For example to make a file named secret to hidden use this command

$cat > .secret
This is a secret file
Now normal ls command will not list this file. Do a ls form current directory

$ls
As you can see in output .secret file is not shown here. But can see hidden file with –a switch.

$ls –a
.secret
Now rename and make it unhidden. Use mv command to rename the file

$mv .secret test
$ls
test
vi editior
If we want to change the matter of file cat will not do it for us. So we will use vi editor to change matter of file.

$vi test
This will open a window with bilking cursor. vi editor work in three different mode.

Esc Command mode [press Esc key before giving any command]
Insert Insert mode [ to start editing use press Insert key ]
Exit Exit mode [ Exit mode can be access via press Ecs key and :]
Beside it there are various command which can be used to control the behavior of vi editor, some of them most command are there to remember

Esc +:+w+q save and exit form file
Esc+:+q+! exit without saving
Esc+:+set nu to show hidden line
Esc+:+/test to find test word in forward directions
Esc+:+21 to move cursor in line number 21
Esc+:+2+yy to copy 2 line form cursor
Esc+:+p to paste the copied line below the crusor
Esc+:+dd to remove the entire line
Esc+:+4+dd to remove 4 line below of cursor
Esc+:+x to remove single character
Esc+:+e to go to end of the word
Esc+:+h to go one character back
We have written a complete article about Vi editor. You can read it for more information about vi editor.

0 Comment:

Post a Comment