Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.

Slides:



Advertisements
Similar presentations
CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
Advertisements

 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
A Guide to Unix Using Linux Fourth Edition
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Vi Editor TA for ITIS3100: Xu Fei
Linux+ Guide to Linux Certification, Second Edition
Chapter 5 Editing Text Files
1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CS465 - UNIX The vi Editor. Creating Files Most human-readable files on Unix are created with a text editor Unix has many, many different editors ed a.
CSCI 330 T HE UNIX S YSTEM Editing files. E DITOR C ONCEPTS Editing a file is to modify the content of a file Text editor: Enter and modify text in a.
Using Linux Text Editors. Use Non-Graphical Linux Text Editors Graphical Text Editor.
1 Unix Text Editors Creating files on the Unix system.
Topics Introduction Hardware and Software How Computers Store Data
Chapter 3 Mastering Editors
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Chapter 3: The UNIX Editors ASCII and vi Editors.
Linux+ Guide to Linux Certification Chapter Four Exploring Linux Filesystems.
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving vi Session Aborting Editing Session.
T HE VI EDITOR. vi has 2 modes: command mode (initial or "default" mode) insert mode [Esc] is used to switch to command mode. In general, vi commands:
Word Lesson 2 Basic Editing
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
Productivity Programs Common Features and Commands.
Microsoft Office Illustrated Introductory, Second Edition Documents Editing.
Introduction to Unix – CS 21 Lecture 8. Lecture Overview More detail on emacs and vi Regular expression matching in emacs and vi.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
Editors And Debugging Systems Other System Software Text Editors Interactive Debugging Systems UNIT 5 S.Sharmili Priyadarsini.
Chapter 5 Editing Text Files. Basic Concept A text editor works on a file buffer that is a memory copy of a disk file The disk file is not updated until.
Text editors Why should I use an editor ? It is very important to able to use at least one text mode editor a text mode editor is so useful on remote machines.
Unix Editors. u Editors in Unix come in two general flavours: –modal editors have "modes" v generally input mode and command mode –input mode allows entry.
Tony Kombol.  Why text edit?  Many programs and features require configuration ▪ Configuration is kept in files ▪ Usually in the /etc directory  Changes.
Unix Session IV.
Text Editing February 2 nd, 2004 Class Meeting 3.
1 of 47 Chapter 4: The vi Editor – First Look Copyright ©2008 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved.
Chapter Three Text Editing1 System Programming Text Editing.
VI EDITOR University of Mississippi. Vi Editor What is Vi ? ▫Vi is a screen based editor. ▫The screen of your terminal will act as a window into the file.
Chapter 9 Using Text Editors. vi Editor visual Editor, ASCII text editor, no formatting capabilities almost as powerful as MS Word, has 26 clipboards.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Lesson 4-Mastering the Visual Editor. Overview Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating.
Chapter Three The UNIX Editors.
Linux Class #03. File Access Permissions Types of users in Linux: Local User (u) Group User (g) Other User (o) Each User can have 3 types of permissions:
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Microsoft Word Level 1 Michael Carco. Word Level 1 Agenda  Word Basics  Navigating in a Document  Inserting and Modifying Text  Creating and Modifying.
Text editing and more basic commands CS 2204 Class meeting 3 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving Edited File Aborting Editing Session.
Agenda Using vi Editor Starting vi Session Command / Input Modes
1. Chapter 1 Creating, Printing, and Editing Documents.
Document Processing Keyboarding Objective 4.01 – Apply formatting and editing features.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Getting Started with Linux Linux System Administration Editors.
BIF703 FTP (File Transfer Protocol) Utility vi editor Utility.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor.
1 Word Lesson 2 Basic Editing Microsoft Office 2010 Introductory Pasewark & Pasewark.
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Guide To UNIX Using Linux Third Edition
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Vi Introduction Tony Kombol.
Linux 104 Training Module File Editing.
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
Topics Introduction Hardware and Software How Computers Store Data
Chapter 2 Basic vi Editor.
Linux Operations and Administration
The Emacs Editor Read: Forouzan, Appendix C
CSCI The UNIX System Editing files
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
Presentation transcript:

Chapter Three The UNIX Editors

2 Lesson A The vi Editor

3 Objectives Describe an ASCII text file Explain why operating system editors use ASCII files Create and edit simple documents using the vi editor

4 Understanding UNIX Files Almost everything you create in UNIX is stored in a file All information stored in files is in the form of binary digits –Binary digits are also known as bits –Bits have two states: 1 (on) and 0 (off) –0’s and 1’s as a way to communicate with a computer is known as machine language

5 Understanding UNIX Files Machine language (or bit combinations) is translated into plain English using ASCII ASCII stands for American Standard Code for Information Interchange –ASCII uses a byte (a string of 8 bits) to represent keyboard characters such as letters and numbers –Text files contain printable, ASCII characters –Binary files contain nonprintable characters, or machine language

6

7 Understanding UNIX Files Programmers develop source code for their programs as text files which are compiled before being executed Programmers also create scripts which are files containing commands. Scripts are not compiled, rather executed through an interpreter at run time Executable Program Files are compiled and interpreted files that can be run on the computer to cause actions to be taken

8 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display the text you are creating (or editing) one screen at a time

9 Using the vi Editor Called vi because it is visual – it immediately displays on screen the changes that you make to text It is also modal – works in three modes –Insert mode - lets you enter text –Command mode - lets you enter commands to perform editing tasks –Extended (ex) command set mode - lets you use an extended set of editing commands

10 Using the vi Editor To create a new file in the vi editor, type vi and the name of the new file at the command prompt

11 Using the vi Editor When started, the vi editor is in command mode –In order to insert text, you must issue the “i” command to enter insert mode –You can repeat the line just entered with the repeat command (.) –To edit what you’ve just typed, move the cursor with the various keyboard cursor movement keys

12 Using the vi Editor In insert mode, every character you type appears on the screen. You are actively entering text into the file.

13 Using the vi Editor To return to command mode, hit the Escape key. Now, hit the. key to repeat the last line. The repeat command repeats the last insertion, or line. Now, edit the new line in order to create the next item

14 Using the vi Editor

15 Using the vi Editor While still in command mode: –To delete text, move to a character and then type “x” –You can undo a command (reverse its effects) by typing “u” –To search for a text pattern, type a forward slash (/), type the pattern, and press Enter

16 Using the vi Editor

17 Using the vi Editor Use the delete commands and the cursor movement keys to edit the text

18 Using the vi Editor

19 Using the vi Editor

20 Using the vi Editor The status line at the bottom of the screen displays information, including line- oriented commands and error messages

21 Using the vi Editor During text searches, you can replace, too. Use line-oriented commands in ex mode to perform this action

22 Using the vi Editor Saving a File and Exiting vi –You should always save the file before exiting vi, otherwise changes are lost –To save a file and continue working on it, hit Escape, type :w filename (write) –While in command mode, use the :wq (write and quit) command to save and exit vi, or the :zz command to exit after saving

23 Using the vi Editor In vi, you can also: –Add text from another file –Leave vi temporarily to perform other UNIX tasks, then return to your file –Change your display while editing, such as adding line numbering to help editing –Copy, cut, and paste text to help editing –Print text files –Cancel an editing session

24 Using the vi Editor

25 Using the vi Editor

26 Lesson B The Emacs Editor Victoria College doesn’t have access to an Emacs editor so just read through the following section. You won’t have any labs on Emacs

27 Vi Practice In the vi editor, show the command used to do the following: 1.change to insert mode –i 2. change from insert mode to command mode –Hit the escape key 3. delete a character –x (You must be in command mode – if you are in insert mode, an x will be entered into the file.) 4. exit the editor and save changes in one step. Assuming that you have already associated a file name with the file. – :wq OR – ZZ OR – :x 5. add a blank line above the current cursor position – O (uppercase O inserts a blank line above, lowercase o inserts a line below the cursor position) 6. search for the word “unix” in the current document – /unix Search for “unix” throughout the entire document and replace it with “linux” – :1,$s/unix/linux/g 7. exit the editor without saving changes – :q!

28 Objectives Compare and contrast the features of Emacs and the vi editor Become familiar with the most important Emacs editor commands Create and edit simple documents using Emacs editor

29 Using the Emacs Editor More complex than vi, so not as popular, but it is more consistent and most commands begin with Alt or Ctrl key combinations It is not modal like vi Supports a sophisticated macro language and lets you extend beyond the Emacs program and read , for instance Emacs is reputed to have more features than any other UNIX program

30

31

32 Using the Emacs Editor Creating a New File in Emacs –Type the Emacs command with the name of the new file after it at the command line –If you are using the GNOME interface, start Emacs by clicking the Main Menu icon, clicking Programs, clicking Applications, and then clicking Emacs

33 Using the Emacs Editor The Emacs editor opens in a GUI, with menus containing command choices

34 Using the Emacs Editor Notice the extensive command choices within the menu structure

35 Using the Emacs Editor To save and exit, perform these key sequences: Ctrl+x and Ctrl+s to save, then Ctrl+x and Ctrl+c to exit

36 Using the Emacs Editor Editing an Emacs File –To navigate the cursor location, use the arrow keys, or Ctrl key combinations –Text is inserted by typing –Ctrl+x and then “u” is the undo command –You can cut, copy and paste text –There is a text search feature as well –Emacs lets you format your documents with the word wrap feature

37 Chapter Summary Bytes are computer characters stored using numeric code, the numeric code is then formatted to plain English via ASCII, and the ASCII characters are stored in text files The vi editor is a popular choice among UNIX users to edit text files In the vi editor’s insert mode, characters you type are inserted in the file With vi, you initially edit a copy of the file in the computer’s memory and the existing file itself is not altered until saved to disk

38 Chapter Summary The Emacs editor is popular as an alternative to the vi editor and is included with UNIX systems, including Linux Emacs has a powerful command syntax, is extensible, and supports a sophisticated language of macro commands You start Emacs by typing the emacs command at the command line You navigate an Emacs file by using cursor movement keys or Ctrl key combinations

39 Chapter Summary In Emacs, you can undo your editing changes in sequence, even after you’ve made many changes In Emacs, you insert text simply by typing it in, plus you have the editing features of copy, cut and paste, as well as text searching features

40