Sunday, March 20, 2011

vi editor switches options descriptions

Hi All,
Now 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 

No comments:

Post a Comment

Popular Posts

Followers

Disclaimer

All Data and Information Provided on This BLOG is only for Education purposes only.If you done any thing else these in real time the blog is not Responsible.Try all those on your own risk.
IF you find any thing else here as per in violation of copyright law .mail me on srinathceh@gmail.com as soon as possible action will be taken.