[ Team LiB ] |
7.3 Useful Linux ProgramsThis section presents several programs you may find helpful in working with your Linux system. You'll learn several commands that report system status and you'll learn how to use pico, a simple text editor. 7.3.1 Viewing System InformationLinux provides a number of commands that report system status. The most commonly used commands are shown in Table 7-8. These commands can help you troubleshoot system problems and identify resource bottlenecks. Although each command can be used without options or arguments, each supports options and arguments that let you customize operation and output; consult the appropriate manpage for details.
7.3.2 Using the pico EditorIf you're working under X, you have access to a variety of GUI text editors. However, GUI text editors cannot be used from a virtual console. The pico editor is a simple text editor that you can think of as the Linux equivalent of the Windows program named Edit, because it can be used in graphical or text mode. Unfortunately, the pico text editor is not a part of the standard Red Hat Linux installation. The standard Red Hat Linux installation does include the text editor vi; however, vi is more difficult to learn than pico. To install the pico editor, install the pine package that contains the editor and the pine email client. To do so, mount installation CD 3, open a terminal window, and issue the command: $ redhat-install-packages /mnt/cdrom/RedHat/RPMS/pine-*.rpm
To start pico, simply type pico at the shell prompt, or if you want to edit a particular file, type pico followed by the name of the file (or the file's path, if the file is not in the working directory). For example, to edit the file mydata, type: [bill@home bill]$ pico mydata Figure 7-5 shows pico's standard display. At the top of the display is a status line, which shows the version of the program and the name of the file being edited (or New Buffer, if the file is new). If the file has been modified, the upper-right corner of the display contains the word Modified. The bottom two lines of the display list the available editing commands. Most of the commands require you to type a control character, so that commands can be distinguished from characters you want to add to the buffer, as pico's work area is termed. Typing an ordinary character inserts it at the current cursor position. You can use the cursor keys to move around the display; you can use the Delete or Backspace key to erase unwanted characters. Some commands use the third line from the bottom to report status and obtain additional input. Figure 7-5. The pico editorTable 7-9 summarizes pico's commands. Notice that the command Ctrl-G accesses pico's help system. You can access several of the commands by using function keys; for example, pressing F1 has the same result as typing Ctrl-G.
Here's a simple exercise that will give you a quick tour of pico. Start pico by issuing the command: pico Then type the following short paragraph of text, including the typographical errors: Pico is is a greet editor. I use it for my light-duty tasks editing. However, when I need to really get down to business, I prefer vi. Notice that three errors appear:
To correct the first error, use the up and left arrow keys to position the cursor on the letter i of the first instance of the word is. Then, press Del three times to erase the word and the following space. Next, use the right arrow key to place the cursor on the second (incorrect) letter e in the misspelled word greet. Type an a and press Del to correct the error by replacing the e with an a. Now, let's revise the phrase "for my" to read "for all my." Simply use the right arrow keys to move to the letter m in the word my. Type all and a space. Finally, let's cut and paste to move the words tasks and editing into their proper sequence. Use the arrow keys to position the cursor on the letter t in the word tasks. Type Ctrl-^ to mark the beginning of a selection. Use the right arrow key to select the remainder of the word and the following text, positioning the cursor on the letter e in the word editing. Cut the selected word by typing Ctrl-K. Now, use the right arrow key to move the cursor past the word editing and type Ctrl-U to paste the text that was cut. The paragraph is now error-free. Save the paragraph to a file by typing Ctrl-X, responding y to the question "Save modified buffer?", typing the desired filename, and pressing Enter. Use the less command to verify that the file was created and has the proper contents. |
[ Team LiB ] |