How to run shell programs in pico editor

Pico is a good, quick, basic text editor for Unix systems. If you have used the Pine email program you are already somewhat familiar with Pico. If not, don't worry: the basics are picked up very quickly. The following sections tell you what you need to know to get started.

These conventions will be used in what follows:

  • Commands to be typed will be put in a typewriter typeface.
  • Placeholders--i.e., variables that are to be replaced by something specific when you type a command--are shown in italics.
  • The shorthand ^X means that you are to press the Control key (marked Ctrl) and, while this key is still depressed, press X (or whatever letter appears in the sequence)

To open an existing document in Pico, you can type pico filename at the Unix prompt. Replace filename with the name of the file you wish to edit, for instance pico myfile.txt. Alternatively, you can start Pico by just typing pico and then reading in the file to edit by typing ^R followed by the name of the file. After ^R, typing ^T will display a listing of the files in the current directory. You can use the arrow keys to move the cursor onto the file you wish to open, then press S to select the file, which will be opened for editing.

  • To save a file after making changes, use the write-out command, ^O. You will be prompted for a filename, the default being the name of the file you opened. You can alter this if you want to save the file under a different name: backspace over the original name and type a new one.

If you are done with Pico, and want to save the file under its original name, you can just use the exit command, ^X. If you have made any changes to the file you will be prompted for a save on the way out. Type y (for ``yes'') and the file will be saved.

Quick summary:

^R

Read in a file

^O

Write out a file

^X

Exit Pine, saving file on the way

 

Moving about in a document

 Pico does not offer mouse support. You can move about using the arrow keys, but remembering a few ^ sequences will make life easier. Here are the ones that I find myself using most often:

^V

Scroll down one screen

^Y

Scroll up one screen

^A

Move to the beginning of the current line

^E

Move to the end of the current line

Editing commands

 Here are some keystrokes that are helpful for basic editing:

  • ^D deletes the character to the right of the cursor.
  • Back Space deletes the character to the left of the cursor.
  • ^K deletes the current line.
  • ^U undeletes whatever was just deleted using ^K

Using ^K and ^U together, you can cut-and-paste or copy-and-paste. To copy-and-paste a line, remove it using ^K then (a) put it back with ^U, and (b) move to the location where you want to paste it and do ^U again. To cut-and-paste, just skip (a). The text inserted by ^U is the cumulated result of the previous consecutive ^Ks, so you can copy or move several lines by doing repeated ^Ks followed by a single ^U in each location where to want to insert the text. Alternatively, you can select (highlight) the text you want to cut or copy: first press ^6 at the beginning of the text you want to highlight, then move the cursor to the end of the block, then do the ^K.

Another useful editing keystroke is ^J or ``Justify''. This command adjusts the line-lengths in the current paragraph to give a more even appearance. (It does not ``justify'' in the sense of creating a flush right margin, which would not be desirable in a plain text file.)

^W (for ``Where?'') is the search command; and ^T calls for a spell-check. Note that ^T performs a different action immediately after ^R-


Comments

Popular posts from this blog

How to create Animated 3d chart with R.

Linux/Unix Commands frequently used

R Programming Introduction