ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: 12252 Week 14 – UNIX vi text editor.

Slides:



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

A Guide to Unix Using Linux Fourth Edition
Introduction to the gedit editor. gedit: the Gnome editor Gnome: Gnome is a freely available (i.e., no cost) desktop environment for the UNIX system The.
Editing with vi Or more fun than you thought you’d have without a mouse Prof. Chris GauthierDickey.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.
Vi Editor TA for ITIS3100: Xu Fei
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.
Starting Vi Opening an existing file vi filename Creating a new file vi filename In your workshop directory, create a new file called mysong vi mysong.
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.
Conversational Computers
Lesson 3 Text Basics Adapted From Source:
Creating a Web Page HTML, FrontPage, Word, Composer.
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.
ITIS 2110 Class # No home network devices devices devices devices devices devices devices 9.
1 Unix Editors (ee, ed, ex, vi, vim) and Compilers (g77, gcc) Speaker: Li-Wen Chen Date:
Chapter 3 Mastering Editors
Pasewark & Pasewark 1 Word Lesson 1 Word Basics Microsoft Office 2007: Introductory.
MICROSOFT WORD GETTING STARTED WITH WORD. CONTENTS 1.STARTING THE PROGRAMSTARTING THE PROGRAM 2.BASIC TEXT EDITINGBASIC TEXT EDITING 3.SAVING A DOCUMENTSAVING.
Word Processing Understanding Microsoft Word 10. Benefits of a Word Processor Word Processing Is the use of a computer and software to produce written.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
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:
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 7 Editing.
Software I: Utilities and Internals Lecture 2 – The vi Text Editor * Modified from Dr. Robert Siegfried original presentation.
Basic Computer and Word Functions, part 1 Read the information and use to answer the questions in the Basic Computer and Word Functions Study Guide.
1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout
UNIX Intro vi  vi is the standard UNIX text editor v Contents 1.Why use vi ? 2. vi Basics 3.Moving Around 4.Inserting Text.
1 Word Lesson 1 Microsoft Word Basics Microsoft Office 2010 Introductory Pasewark & Pasewark.
4 Editing files and Emacs Editing files The Emacs editor.
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.
Introduction to Unix – CS 21 Lecture 7. Lecture Overview Regular expressions revisited emacs versus vi Basic emacs and vi usage.
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.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
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.
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
Vi editor Pronounced: `vee eye‘’. Agenda Describe the background of vi Editor Use vi editor to: create text files edit text files Our Goal is to create.
1 Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008 Chapter 6: The vi Editor – Last Look 1 of 55 Copyright ©2008 by Pearson Education, Inc. Upper Saddle.
BIF703 FTP (File Transfer Protocol) Utility vi editor Utility.
Basic VI Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
CS:414 introduction to Unix and Linux
CS1010: Intro Workshop.
Vim basics Vi IMproved.
Guide To UNIX Using Linux Third Edition
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Vim.
Vi Introduction Tony Kombol.
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
Chapter 2 Basic vi Editor.
Linux Operations and Administration
The Emacs Editor Read: Forouzan, Appendix C
CSCI The UNIX System Editing files
In the last class… The vi basics command, input and ex mode
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
Presentation transcript:

ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor Reference:

Start Ubuntu  Start VMware Player   Select Ubuntu 

Login to Ubuntu Username :itx2000 Password:MDXstudent

Switch mouse click Click in the virtual screen to work on UNIX systems. Ctrl + Atl to work on Windows.

VI (visual editor)  The vi editor (short for visual editor) is a screen editor which is available on almost all Unix systems.  Once you have learned vi, you will find that it is a fast and powerful editor.  vi has no menus but instead uses combinations of keystrokes in order to accomplish commands.

Starting vi  To start using vi, at the Unix prompt type vi followed by a file name.  vi myFile.txt (then hit return)

vi's Modes and Moods  vi has two modes: the command mode and the insert mode.  When you are in command mode, letters of the keyboard will be interpreted as commands.  When you are in insert mode the same letters of the keyboard will type or edit text.  vi always starts out in command mode.  You can type i to enter the insert mode.  If you wish to leave insert mode and return to the command mode, hit the ESC key.  If you're not sure where you are, hit ESC a couple of times and that should put you back in command mode.

General Command Information As mentioned previously, vi uses letters as commands. It is important to note that in general vi commands:  are case sensitive - lowercase and uppercase command letters do different things  are not displayed on the screen when you type them  generally do not require a Return after you type the command. You will see some commands which start with a colon (:).

Entering Text  To begin entering text in an empty file, you must first change from the command mode to the insert mode.  To do this, type the letter i.  When you start typing, anything you type will be entered into the file.  Type a few short lines and hit Return at the end of each of line.  Unlike word processors, vi does not use word wrap. It will break a line at the edge of the screen.  If you make a mistake, you can use Delete or Backspace key to remove your errors.

Cursor Movement You must be in command mode if you wish to move the cursor to another position in your file. If you've just finished typing text, you're still in insert mode and will need to press ESC to return to the command mode. Moving One Character at a Time Try using your direction keys to move up, down, left and right in your file. Sometimes, you may find that the direction keys don't work. If that is the case, to move the cursor one character at the time, you may use the h, j, k, and l keys.  h left one space  l right one space  j down one space  k up one space

Moving among Words and Lines  There are some shortcut keys that you can use to move a little more quickly through a document.  To move more quickly among words, you might use the following:  w moves the cursor forward one word  b moves the cursor backward one word (if in the middle of a word, b will move you to the beginning of the current word).  e moves to the end of a word.  To build on this further, you can precede these commands with a number for greater movement.  For example,  5w would move you forward five words;  12b would move you backwards twelve words.  [You can also use numbers with the commands mentioned earlier.  For example, 5j would move you down 5 characters.]

Summary – vi basics (view)  vi to open a file for editing  ←↑→↓ move the cursor left up right and down. also j,k,h,l accomplish the same thing  x or Delete delete the letter over the cursor  dd deletes a line  dw deletes the word  yy yanks a line into the buffer,  pp paste the line at the cursor,  / performs a regular expression search for a certain word i.e., ‘/test ↵ ’ will place the cursor at the first instance of the word  cw allows you to change the word under the cursor (press esc when done)  r allows you to change the character under the cursor.

Summary – vi basics (insert) i, I puts vi into insert (edit) mode at/before the cursor o, O puts vi into insert mode above/below the current line ( it creates a new line) a, A inserts text at the beginning/ending of the current line. To exit insert mode hit the ESC key.

Summary – vi basics (command) to enter command mode use : in view mode or esc : in insert mode Basic Command options  :q Quit vi,  :w save the current file,  :qw save the file and quit vi  :q! force quite vi without writing changes  :/ find selected pattern in file  :^ go to the beginning of the file  :$ go to the end of the current file.  : got to the line number in the file.

CW2 – part 1 (25%) Task 1 (25%). Using vi editor to create a file in a UNIX-like environment. For example, type in the following paragraph: In multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user. Traditionally daemon names end with the letter d: for example, ‘syslogd’ is the daemon that implements the system logging facility and ‘sshd’ is a daemon that services incoming ‘SSH’ connections. In a Unix environment, the parent process of a daemon is often, but not always, Deadline: week 22 (March 23-27), to show to the lab tutors