UNIX For Dummies [Electronic resources] نسخه متنی

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

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

UNIX For Dummies [Electronic resources] - نسخه متنی

John Levine, Margaret Levine Young

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

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

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






A Peek at pico

One other editor has become popular:

pico . As the Pine e-mail program has spread like wildfire, the editor that comes with it, pico , has taken off, too.

pico is the easiest to use of the four text editors we describe in this chapter, albeit not the most powerful. Folks at the University of Washington wrote it.
To run pico , type this command:


pico eating.peas

As usual, type the name of the file you want to edit rather than eating.peas. If you type a filename that doesn’t exist, pico creates a file with that name just for you.

Your system may not have pico — if not, ask your system administrator if she can get it for you. Assure her that if she doesn’t, you’ll pester her ten times a day for the next year for help with ed or vi .

The pico screen looks like the one shown in Figure 10-5. Amazing —

pico shows you at the bottom of the screen a menu of the most commonly used commands! What will they think of next?


Figure 10-5: The pico editor is easy to use, with a small menu at the bottom of the screen.


You’re my type


Typing text into a file by using pico is a breeze. Just type. That’s all. No modes, commands, or anything strange.


You move me


If your cursor keys work in pico , great. If not, you can use Ctrl+F to move forward one character, Ctrl+B to move back one character, Ctrl+N to move to the next line, and Ctrl+P to move to the preceding line. The following keys also move you around the screen:


Ctrl+A moves to the beginning of the line.



Ctrl+E moves to the end of the line.



Ctrl+V moves forward one screen of text (F8 does this, too).



Ctrl+Y moves back one screen of text (as does F7).




You’re a big help


To get help with the pico commands, press Ctrl+G. If your keyboard has an F1 key, that should work, too. You see pages of helpful information about the program. Press Ctrl+V to see more or Ctrl+X to return to pico .


Time for a change


Editing your text in pico is also easy. Whatever you type is inserted wherever the cursor is. You can use these commands to edit stuff:



Ctrl+D deletes the character the cursor is on.



Ctrl+^ (that’s Ctrl+Shift+6) marks the beginning of some text you want to work with. You use this command to select a bunch of text to delete or move.



Ctrl+K (or F9) deletes (cuts) the text from the mark to the current cursor position. Blammo! — the text is gone and is stored in an invisible holding tank somewhere.



Ctrl+U (or F10) uncuts or pastes the last text you cut, making it reappear where the cursor is now.




Thanks for saving my file


To save the text in a file, press Ctrl+O (or press F3).

pico asks for the filename to write the text into, suggesting the filename you used when you ran pico in the first place. You can change the name so that the text is written to a new file or leave it as is, to update the existing file. When you press Enter, pico writes the information into the file.


I’m outta here


When you finish editing and want to leave pico , just press Ctrl+X. If you haven’t already saved your file, pico asks whether you really want to leave, because leaving will lose any changes you made to the file since you last saved it. Tell it that you do. Then you’re out, and you see the shell prompt.

pico doesn’t claim to be an editor with the power of emacs or vi . After all, you can’t edit ten files at a time, read your mail, and rename files from pico . Who cares? It’s a nice, easy program for editing text. Isn’t that what a text editor is supposed to be?







Editors galore


UNIX being UNIX, you could use many more text editors in addition to the Big Three (and reluctant Fourth) described in this chapter, including such alien-sounding programs as sed , perl , and awk . The popular vim editor is a souped-up, X-ified version of vi . KDE comes with two editors, KEdit (a relatively simple one) and Kate (a fancier one), GNOME comes with gedit (a relatively simple, as far as anything in GNOME is simple, editor), and Cream (a GNOME-ized version of vim ). A little searching around will find you more editors than you could try out in your lifetime. We suggest that unless you have a compelling reason to use a different editor, such as everyone else in your company uses another editor, stick with one of the Big Three. Someday you’ll switch to another version of UNIX, and if your favorite editor isn’t there, you’ll either waste a lot of time finding and installing a copy of your editor, or else relearning one of the editors that it does have. But the Big Three are all either there, or easily added.











Table 10-3 lists the top pico commands.

























































Table 10-3: Commands in pico

Command

Description

Ctrl+A

Move to the beginning of the line

Ctrl+B

Move back one character

Ctrl+D

Delete one character

Ctrl+E

Move to the end of the line

Ctrl+F

Move forward one character

Ctrl+G (or F1)

Get help (display online help information)

Ctrl+K (or F9)

Kill (delete) selected text (text between the mark and the cursor)

Ctrl+N

Move to the next line

Ctrl+O (or F3)

Output (save) the file

Ctrl+P

Move to the preceding line

Ctrl+U (or F10)

Uncut (paste) the last text that was deleted by using the Ctrl+K command

Ctrl+V (or F8)

Move down one screen

Ctrl+X (or F2)

Exit from pico

Ctrl+Y (or F7)

Move up one screen

Ctrl+^ (Ctrl+Shift+6)

Mark the beginning of selected text


/ 213