Unix Text Editors - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Unix Text Editors

Description:

wq writes the changes, and then quits. 23. The echo command. Another way to create a small text file is to use echo ... can be used to create a new text file ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 24
Provided by: jimdab
Category:

less

Transcript and Presenter's Notes

Title: Unix Text Editors


1
Unix Text Editors
  • Chapter 15 16

2
Unix Text Editors
  • What is a text editor?
  • Three popular ones exist here on alpha
  • pico
  • emacs
  • vi
  • Going to give an overview of each
  • Focus on pico, the easiest

3
pico
  • Created at the University of Washington
  • Very popular program
  • Easiest to use of all text editors

4
Starting pico
  • pico file name
  • file name can be an existing file
  • If file name does not exist, it will be created
  • Pico displays most control commands
  • Just type

5
Pico Navigation
  • Use arrow keys, otherwise
  • Ctrl-f move forward a character
  • Ctrl-b move backward a character
  • Ctrl-n move to the next line
  • Ctrl-p move to the previous line
  • Ctrl-v move forward one page
  • Ctrl-y move backward one page

6
Pico Editing
  • Inserting
  • Just type
  • Deleting
  • Ctrl-k deletes the current line of text
  • Ctrl-u uncuts the last cut text

7
Exiting Pico
  • To exit
  • Ctrl-x
  • May need to save your work

8
emacs
  • Probably the most powerful
  • More than just a text editor
  • Could take whole classes on emacs

9
Starting emacs
  • emacs file name
  • file name can be an existing file
  • If file name does not exist, it will be created
  • Just type
  • No control commands are displayed

10
emacs navigation
  • Use the arrow keys (if they exist), otherwise
  • Ctrl-f forward one character
  • Ctrl-b backward one character
  • Esc-f forward one word
  • Esc-b backward one word
  • Ctrl-n next line
  • Ctrl-p previous line
  • Ctrl-v next screen
  • Esc-v previous screen

11
emacs editing
  • Inserting
  • Just type
  • Deleting
  • delete deletes backward
  • Ctrl-d deletes forward
  • Esc-delete deletes back one word
  • Esc-d deletes forward one word

12
emacs editing
  • Killing yanking
  • Ctrl-k kills from the cursor to the end of the
    line
  • Ctrl-y yanks the text back out of memory

13
Saving Exiting emacs
  • To save your work
  • Ctrl-x Ctrl-\
  • To exit emacs
  • Ctrl-x Ctrl-c
  • Will prompt you to save if necessary

14
vi text editor
  • Generally comes on all Unix systems
  • Probably the worst interface of all
  • Many hard-core Unix users love it
  • There is an updated version, vim, that is quite
    popular

15
vi text editor
  • Invoked the same way as emacs pico
  • vi file name
  • file name can be an existing file.
  • If file name does not exist, will be created
  • The vi window
  • Note the
  • In command mode

16
vi modes
  • Command mode
  • Get to command mode by pressing the esc key
  • Keystrokes execute commands
  • Input mode
  • Get there by typing certain commands from command
    mode.
  • Keystrokes type letters on the screen

17
vi modes
  • Last line mode
  • Get there by typing a from the command mode
  • Begins with a (colon) also used to issue
    commands
  • No way to tell what mode you are in

18
Command mode
  • Navigation
  • Use the arrow keys or
  • l or space move forward one character
  • h or backspace move back one character
  • j or return move down one line
  • k or - move up one line

19
Input mode
  • Inserting text from command mode
  • i inserts text to the left of the cursor
  • a inserts text to the right of the cursor
  • R replaces the text as you type
  • o inserts a blank line below the current line
  • O inserts a blank line above the current line
  • All of these commands put you into the input mode

20
Command mode
  • Deleting text
  • x deletes one character
  • dd deletes an entire line
  • Number modifier for both

21
Line mode
  • Saving and exiting
  • From command mode type a (colon)
  • Places you into the line mode
  • Then type the command to execute

22
Line mode
  • q quits the program - unless changes have been
    made
  • w writes (saves) the changes
  • q! quits without saving changes
  • wq writes the changes, and then quits

23
The echo command
  • Another way to create a small text file is to use
    echo
  • echo repeats the text of its input to group
    several words together use double quotes
  • Be redirecting output, echo can be used to create
    a new text file
  • (alpha2) 3 echo "The quick brown fox jumped over
    the
  • lazy dog" gt keytest.txt
Write a Comment
User Comments (0)
About PowerShow.com