Vi editor

Posted on 2013-06-14
Last Modified: 2016-02-11
Hello Linux/Unix experts,

I have an application based off FREEBSD.
Using the VI editor, I open up a text document.

how do i

1) Page all the way to the top of the document and page all the way to the bottom of the document

2) search for keyword TEST
Question by:trojan81
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
LVL 31

Assisted Solution

farzanj earned 133 total points
ID: 39249179
Go to the command mode by pressing Esc key

To go to the top


For bottom of document


To search test in command mode


and hit enter
LVL 31

Expert Comment

ID: 39249186
Another way to navigate is to go to command mode by pressing Esc and do

To go to line number 1
Or you can give any line number

And for last line you can use $

In search some people use :/TEST

But : is really not needed.

To go to next TEST forward, use n
To go to next TEST backward, use N
LVL 29

Assisted Solution

serialband earned 133 total points
ID: 39249551
Some other useful navigation controls.
Control+D pages down half a page at a time
Control+U pages up half a page at a time
Control+F pages down a full page at a time
Control+B pages up a page at a time

Here's a web page with the command list for vi.
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

LVL 38

Accepted Solution

Gerwin Jansen, EE MVE earned 134 total points
ID: 39250109
See comments above by farzanj - easiest IMHO are:


(no command mode needed)

After searching once for /TEST - use n to find again (in same direction). To change direction (with same pattern) use ? and then n again to find again (the other direction).
LVL 31

Expert Comment

ID: 39252869
What?  No one added anything to my answer which was accurate and a day earlier.  One expert answer was not even addressing the question.  Second one repeated pretty much what I said earlier, just gave fewer options.
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39253839
@trojan81 - I agree with farzanj - you could have split a bit differently in this case, I added the search direction options though that are useful.
LVL 31

Expert Comment

ID: 39253847
Thank you Gerwinjansen.  I had the direction included too.  You see you can simply do it with /SEARCH and then you want to go forward you press 'n' and for backwards you press 'N'.
/SEARCH and ?SEARCH is just another way to do the same.
LVL 29

Expert Comment

ID: 39254271
I didn't bother addressing the direct question, because you had already addressed it.  I decided to add additional value by providing additional navigation instructions as well as include a link with more vi commands.

Are you getting paid based on points?  I've lost out on many points this same way.  It's just points, it happens, not a big deal.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
android secure ftp 3 70
Apache LDAP Authentication 20 52
NTPD Client Port Usage 12 62
postfix start error! 9 50
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question