4.3.3.3. ...using a filename in one command, and then reusing that filename in the next command?

Press Esc-_ (underscore) to copy the last argument from the previous command. For example, to create a directory and then change to that directory:

$ mkdir backup-directory-august

$ cd (press Esc, _)

$ cd backup-directory-august

4.3.4. Where Can I Learn More?

? The Linux Standard Base project: http://www.linuxbase.org/

? The manpages for bash , rm , cp , mv , ls, file , and less

? The Konqueror Handbook (press F1 in a Konqueror window)

? The GNOME User's Guide (press F1 in a Nautilus window)

4.4. Basic Text Editing Using vi

Fedora Core, like most other Linux and Unix systems, stores most of its configuration information in text files. These files can be edited using various system administration tools, but they can also be edited by hand using any standard text editor.

vi is one such text editor. Some people love it, and some people hate it, but it has one advantage over just about every other editor available: it's universal. If you know how to use vi , you can confidently walk up to just about any Linux or Unix computer in the world and edit text files, so it's a valuable skill. The other nice fact about Vi is that it's not very demanding; you can use it in character mode or graphic mode, over a congested remote connection or with a foreign keyboard, and still get the job done. You can get by with less than a dozen commands to start, and then learn more when you need them.

vi is pronounced 'vee-eye,' not 'vye' or 'six.'

4.4.1. How Do I Do That?

To start up the vi editor, simply type its name at a shell prompt, optionally providing the name of a file you wish to edit as an argument:

$ vi filename

The screen will clear, and the specified file will be displayed, as shown in Figure 4-4 .

Figure 4-4. Initial vi display

Notice that unused lines are marked with a tilde (~) character.

4.4.1.1. vi modes

vi uses two distinct modes:

? Normal mode , where the text keys issue editing commands. This is sometimes called command mode .

? Insert mode , where text keys insert text into the document.

The lower-left corner of the display shows the current mode: if it says -- INSERT -- , then you're in insert mode; otherwise, you're in normal mode.

4.4.1.2. Moving around

You can move the cursor around using the arrow keys. If your arrow keys don't work (which may be the case if you're using a remote connection from a bad terminal program), you can use the h, j, k, and l keys, as shown in Table 4-7 .

Table 4-7. Basic vi movement commands

Command Description
Left, h, or Backspace Move left one character.
Down or j Move down one line.
Up or k Move up one line.
Right, l, or Space Move right one character.
Вы читаете Fedora Linux
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату