Linux [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux [Electronic resources] - نسخه متنی

Janet Valade

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Moving Around a File in vi


Usually, you can use the arrow keys on your keyboard to move around the open file in vi. In some cases, such as a very old or very minimal Linux installation, the arrow keys don't operate.

You can always move around your file using the key commands in Table 18-1.

Table 18-1. Commands for Moving Around in a File

Key

What It Does

j

Moves cursor down one line.

k

Moves cursor up one line.

l

Moves cursor one character to the right.

h

Moves cursor one character to the left.

G

Moves cursor to the last line of the file.

L

Moves cursor to the last line on the screen.

Ctrl-d

Moves down one screen.

Ctrl-u

Moves up one screen.

:n

Moves the cursor to line n. For instance, :1 moves to the first line of the file.

$

Moves to the end of the current line.

^

Moves to the first non-space character in the current line.

0 (zero)

Moves to the beginning of the line.

w

Moves to the beginning of the next word.

b

Moves to the beginning of the previous word.

e

Moves to the end of the word.

NOTE

Be sure to use the correct case. vi is case sensitive. It doesn't see a and A as the same command.

In addition to the commands to move the cursor, you can move to specific text characters or strings by searching for them. You can search for a character in a line using the f (find) command. The syntax is fx, where x is the character to find. For instance, fh moves to the next

h .

To search the entire file, press /. The cursor moves to the bottom of the screen. Type the text to search for. When you press <Enter>, the cursor moves to the next instance of the text. After finding one instance of the text, just press / again to search further for the same text. Use ? to search backward through the file.


    / 357