Indiana University
University Information Technology Services
What are archived documents?

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.


In vi, how do I go to a particular line or word in a file?

You can go to a particular line or word in a file using vi in several ways:

  • To make vi start at a particular line in a file, add +line_num to the command you use to start vi. Replace line_num with the line number, for example: vi +36 foo.c
  • If you're already in vi, you can use the goto command. To do this, press Esc, type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in the file.

  • You can also use the ex command line to go to a line. (For information about the ex mode, see How do I use the vi text editor?) For instance, if you wanted to go to line 14, you could press Esc and then enter: :14
  • To search forward for some text, use the  /  (forward slash) command. Press Esc and then enter /pattern , replacing pattern with the text for which you want to search forward. For example, to find every instance of the word "blimp", enter: /blimp To look for the next occurrence after the first, either press  n  or press  /  again and then press Enter. To go back to a previous occurrence, press Shift-n . To search backwards in a file, use the  ?  command.

  • To see what line you're on at any time, press Ctrl-Shift-g . To number all lines, press Esc and enter: :set number

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document adxw in domain all.
Last modified on August 22, 2008.

I need help with a computing problem

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

I have a comment for the Knowledge Base

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.