How to get a particular line or word in a file in Linux through vi command ?

  StradSolutions

Login to server through SSH Putty.

  1. You can jump to a particular line in a file, in Linux through vi command. 
    Syntax: vi +line_number file_name 

        Example: vi +2 test.txt

2. If you have already in the file through vi editor and want to jump on particular line then  press Esc key, type the line number: 

3. If you want to search any particular text, use the / (forward slash) command.

If you are already opened file through vi editor Press Esc and then enter /word.

replace word with the text for which you want to search forward. 

4. If you want to know on which line you are at any time, press Ctrl-Shift-g and Enter.

LEAVE A COMMENT