1 unix text editors creating files on the unix system

15
1 Unix Text Editors Creating files on the Creating files on the Unix system. Unix system.

Upload: samson-tucker

Post on 26-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Unix Text Editors Creating files on the Unix system

1

Unix Text Editors

Creating files on the Unix system. Creating files on the Unix system.

Page 2: 1 Unix Text Editors Creating files on the Unix system

2

Unix Text Editors

What is a text editor?What is a text editor? Three popular ones exist here on millerThree popular ones exist here on miller

picopico emacsemacs vivi

Page 3: 1 Unix Text Editors Creating files on the Unix system

3

Pico

Simplest to use of all text editors.Simplest to use of all text editors. Runs in existing window.Runs in existing window. Options and commands listed at the bottom Options and commands listed at the bottom

of the pico window. of the pico window. Use this text editor when working over Use this text editor when working over

telnet.telnet.

Page 4: 1 Unix Text Editors Creating files on the Unix system

4

Starting pico

pico [file name] pico [file name] [file name] can be an existing file. [file name] can be an existing file. If [file name] does not exist, it will be If [file name] does not exist, it will be

created. created. Pico opens in the existing xterm windowPico opens in the existing xterm window Just type in the window. Do not use the Just type in the window. Do not use the

mouse. mouse. Use arrow keys and <ctrl>y and <ctrl>v to Use arrow keys and <ctrl>y and <ctrl>v to

move up and downmove up and down

Page 5: 1 Unix Text Editors Creating files on the Unix system

5

Pico Navigation

Does not support inline mouse clicking.Does not support inline mouse clicking. Use arrow keys, otherwise: Use arrow keys, otherwise:

Ctrl-p: move to the previous line. Ctrl-p: move to the previous line. Ctrl-v: move forward one page. Ctrl-v: move forward one page. Ctrl-y: move backward one page. Ctrl-y: move backward one page. Ctrl-w: to findCtrl-w: to find Ctrl-c: to show current line numberCtrl-c: to show current line number

Page 6: 1 Unix Text Editors Creating files on the Unix system

6

Pico Editing

InsertingInserting Use arrow keys to navigate Use arrow keys to navigate Just type. Just type.

Deleting Deleting Ctrl-k: deletes the current line of text. Ctrl-k: deletes the current line of text. Ctrl-u: uncuts the last cut text. Ctrl-u: uncuts the last cut text. Use the backspace key to delete character at a Use the backspace key to delete character at a

time.time.

Page 7: 1 Unix Text Editors Creating files on the Unix system

7

Exiting Pico

To Save. Can save your work without exiting. To Save. Can save your work without exiting. Called ‘writeout’Called ‘writeout’ Ctrl-oCtrl-o

To exit:To exit: Ctrl-xCtrl-x

May need to save your work.May need to save your work. Upper right hand corner will show word Upper right hand corner will show word

modified if changes have been made. You will modified if changes have been made. You will prompted to save file if modified.prompted to save file if modified.

Page 8: 1 Unix Text Editors Creating files on the Unix system

8

emacs

More powerful and has more features than More powerful and has more features than pico. pico.

More than just a text editor. Can be used as More than just a text editor. Can be used as a development toola development tool

Could take whole classes on emacs. Could take whole classes on emacs. Looks much like MS Text. Has menu bar Looks much like MS Text. Has menu bar

with familiar features and options.with familiar features and options.

Page 9: 1 Unix Text Editors Creating files on the Unix system

9

Starting emacs

emacs [file name] &emacs [file name] & ‘‘&’ allows you to run other programs and &’ allows you to run other programs and

toggle between windows because emacs toggle between windows because emacs runs in its own window. runs in its own window.

[file name] can be an existing file. [file name] can be an existing file. If [file name] does not exist, will be created. If [file name] does not exist, will be created. Just type. Just type.

Page 10: 1 Unix Text Editors Creating files on the Unix system

10

emacs navigation

Use the arrow keys (if they exist), otherwise:Use the arrow keys (if they exist), otherwise: Ctrl-f: forward one characterCtrl-f: forward one character Ctrl-b: backward one characterCtrl-b: backward one character Esc-f: forward one wordEsc-f: forward one word Esc-b: backward one wordEsc-b: backward one word Ctrl-n: next lineCtrl-n: next line Ctrl-p: previous lineCtrl-p: previous line Ctrl-v: next screenCtrl-v: next screen Esc-v: previous screenEsc-v: previous screen

Page 11: 1 Unix Text Editors Creating files on the Unix system

11

emacs editing

InsertingInserting Navigate with arrow key or mouseNavigate with arrow key or mouse Just type. Just type.

DeletingDeleting [delete]: deletes backward. [delete]: deletes backward. Ctrl-d: deletes forward. Ctrl-d: deletes forward. Esc-[delete]: deletes back one word. Esc-[delete]: deletes back one word. Esc-d: deletes forward one word. Esc-d: deletes forward one word.

Page 12: 1 Unix Text Editors Creating files on the Unix system

12

emacs editing

Killing & yanking. Killing & yanking. Ctrl-k: kills from the cursor to the end of Ctrl-k: kills from the cursor to the end of

the line. the line. Ctrl-y: yanks the text back out of Ctrl-y: yanks the text back out of

memory. memory.

Page 13: 1 Unix Text Editors Creating files on the Unix system

13

Saving & Exiting emacs

To save your workTo save your work Ctrl-x Ctrl-s (normal command)Ctrl-x Ctrl-s (normal command) Ctrl-x Ctrl-\ (on the alphas)Ctrl-x Ctrl-\ (on the alphas)

To exit emacsTo exit emacs Ctrl-x Ctrl-cCtrl-x Ctrl-c Will prompt you to save if necessary. Will prompt you to save if necessary.

Page 14: 1 Unix Text Editors Creating files on the Unix system

14

Copying and Pasting.

When you highlight (anything) it When you highlight (anything) it automatically gets copied.automatically gets copied.

When you center click it pastes whatever When you center click it pastes whatever was previously copied. This works with was previously copied. This works with text editors AND at the command line. text editors AND at the command line.

Good way of copying long pathnames for Good way of copying long pathnames for cp and cd. cp and cd.

Useful for copying text from netscape and Useful for copying text from netscape and pasting into text editor.pasting into text editor.

Page 15: 1 Unix Text Editors Creating files on the Unix system

15

Reading

Chapters 12 - 15.Chapters 12 - 15.