Download this Blogger Template by Clicking Here!

Ad 468 X 60

banner

Monday 1 April 2013

Widgets

Navigation with vim (Linux command)

Navigation with vim

seenario:   You wish to familiar yourself with vim by navigation a copy of a familiar document, /etc/passwd.

Instructions:

1.Log in as user student with the password student.If you are using the graphical environment,start a terminal by clicking Applications->Accessories->Terminal


2.Create your own copy of /etc/passwd in your home directory:
 [student@stationX ~]$ Cp /etc/passwd  ~

=> Note that if you intended to actually modify this file you would have to be logged in as root and it would be considered best-practice to use the vipw command instead  of running vim directly.Vipw user prevents other instances of vipw from opening the file at the same time.That way two administrators cannot accidentally overwrite each other's changes.

3.Open your copy of passwd in vim 
   [student@stationX ~]$vim ~ /passwd

4.First, try moving around using stander keys such as the arrows,PgUp, PgDn,Home and End.They should all work as expected.Note,however,that on older systems they might not.

5.Now try moving from word to word with the W and B keys.Note that the keys for moving by sentence and paragraph simply move from one end of the file to the other.why is this? 

6.Try combining number with movement keys.For example: 
 5w   
 2Down Arrow 

7.Next you will enter insert mode and make some changes.Remember that since you are working as a non-root user on a copy of the real passwd file,there is no danger of actually damaging the  system.Press the i key.Note that the word INSERT appears at the bottom of your screen.Note that the arrow keys still move you cursor,but the other keys now modify the document,as they would in an ordinary text editor.

8.Once you have changed some text,exit insert mode by pressing Esc.Note that the Insert disappears from the bottom of your screen.

9.Try pressing the u key.This will undo each change that you made.Changes can be re-done with Ctrl-r.

10.Now change vim's behavior by altering some settings.To do this,you will need to enter ex mode.Remember that ex mode is invoked by typing : while in command mode.Do this now.

11.At the ex prompt(:)enter set nu.this is short for set number,which turns on vim's line numbering feature.you should now see line number displayed on the left side of your screen.

12.Try entering ex mode again and disabling line numbering by typing :set nonu.Repeat the previous command to turn it back on.

13.Try jumping to line 5 by typing 5G.You can jump to the end of the file by typing G by its self.how might you jump to the first line of the file?         

14.Try jumping to the fist instance of the word root by using vim's search feature: /root.Note that every instance of root is now highlighted.What happens when you press then key?What about N? 

15.Next,we will introduce some more options relevant to the search feature.suppose you do not want search results to be highlighted.Try typing :set nohls.What happens to the highlighting?How could you re-enable this feature?To turn off the current highlights,use:nohl

16.It is time to finish up and quit vim.Try running :q.This will fail.Note the error message.How could you change the command so that vim is forced to quit,abandoning changes?Once you have figured this out,run the command.       

This article is using only Linux user command with Red hat that's very power full command of navigation.
       THANK YOU FOR VISITED GURU NETWORK PLEAS DON'T COPY THIS ARTICLE 
     

SHARE THIS POST   

  • Facebook
  • Twitter
  • Myspace
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
Author: Kuldipsinh
Hi! I am Kuldipsinh,a certified Indian Network Consultant,Pro Blogger,Computer Engineer Software Editor and an addicted Web Developer. Read More →

1 comment:

  1. Navigation With Vim (Linux Command) >>>>> Download Now

    >>>>> Download Full

    Navigation With Vim (Linux Command) >>>>> Download LINK

    >>>>> Download Now

    Navigation With Vim (Linux Command) >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete