Getting Started with Linux Linux System Administration Editors.

Slides:



Advertisements
Similar presentations
In the last Session… ls -l command seven fields nine permissions of a file ls -ld file ownership file permissions (three-tiered file protection system)
Advertisements

CS 497C – Introduction to UNIX Lecture 8: The vi/vim Editor Chin-Chih Chang
A Guide to Unix Using Linux Fourth Edition
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.
Vi Editor TA for ITIS3100: Xu Fei
Chapter 5 Editing Text Files
CS 202 Computer Science II Lab Fall 2009 September 3.
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.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
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.
Using Linux Text Editors. Use Non-Graphical Linux Text Editors Graphical Text Editor.
1 Unix Editors (ee, ed, ex, vi, vim) and Compilers (g77, gcc) Speaker: Li-Wen Chen Date:
Chapter 3 Mastering Editors
Grades Please hand in your homework Quizzes coming back today Current grade on back with missing assignments Anything missing can be turned in late There.
Get to Know Your Keyboard. Operational Keys Escape (Esc) – allows you to exit unwanted menus and dialog boxes Tab – used to indent; moves the cursor 5.
Chapter 3: The UNIX Editors ASCII and vi Editors.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving vi Session Aborting Editing Session.
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.
Editing, vi and Configuration Files Introduction to Linux June 16, 2009 Papeete, French Polynesia Hervey Allen.
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.
Getting Started with Linux Linux System Administration Editors.
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.
PacNOG 6: Nadi, Fiji Editing, vi & Configuration Files Hervey Allen Network Startup Resource Center.
Editing, vi and Configuration Files Unix/IP Preparation Course May 29, 2011 Dar es Salaam, Tanzania
Agenda Using vi Editor Starting vi Session Command / Input Modes Entering Text Editing Text Saving Edited File Aborting Editing Session.
Editing, vi and Configuration Files Introduction to Unix May 25, 2008 Rabat, Morocco Hervey Allen.
Editing, vi and Configuration Files Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
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.
Editing, vi and Configuration Files Unix/Linux Preparation Course June 27, 2010 Pago Pago, American Samoa
Shell Script Reference: Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook
1 Day 4 Introduction to VI. 2 Vi – Visual Editor Used to edit text files on a UNIX system –Now also available for Windows/Mac etc. Very powerful for editing.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 14 – UNIX vi text editor.
SUSE Linux Enterprise Desktop Administration
Guide To UNIX Using Linux Third Edition
Editing, vi and Configuration Files
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.
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
Editing, vi and Configuration Files
Linux System Administration Editors
Users and Accounts Lab 0.1. Users and Accounts Lab 0.1.
Privileges: who can control what
The Linux Command Line Chapter 12
C151 Multi-User Operating Systems
Chapter 2 Basic vi Editor.
Linux Operations and Administration
The Emacs Editor Read: Forouzan, Appendix C
Lab 7 Shell Script Reference:
CSCI The UNIX System Editing files
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
The Linux Command Line Chapter 12
Presentation transcript:

Getting Started with Linux Linux System Administration Editors

Goals - Be able to edit a file using vi - Begin to understand the “language” of configuration files - Use alternate editors: ee, joe, pico, nano, emacs, xemacs, gedit, etc.

vi Philosophy It's available! Wait, what was that? Oh yeah, it's available! It's has some very powerful features. It's ubiquitous in UNIX and Linux ( visudo, vipw, vigr, etc.) Not that hard to learn after initial learning curve. Impress your friends and family with your arcane knowledge of computers.

Why is vi “so hard to use”? Like all things it's not really – once you are used to how it works. The critical vi concept: 1. vi has two modes 2. These modes are insert and command Let's see how we use these...

vi command and insert modes Swapping modes  When you open a file in vi you are in command mode by default.  If you wish to edit the file you need to switch to insert mode first.  To exit insert mode press the ESCape key.  If you get used to this concept you are halfway done to becoming a competent vi user.

vi insert mode Two common ways to enter insert mode upon opening a file include:  Press the “i” key to start entering text directly after your cursor.  Press the “o” key to add a new line below you cursor and to start adding text on the new line.  Remember, to exit insert mode press the ESCape key at any time.

vi command mode Many, many commands in vi, but some of the most common and useful are:  Press “x” to delete a character at a time.  Press “dd” quickly to press the line you are on.  Press “/”, and text to search for and press. Press “n” to find the next occurrence of text. Press “N” to find previous occurrences of text.

Saving a file or “How to exit vi” 1. In vi press the ESCape key to verify you are in command mode. 2. Depending on what you want to do press: :w → write the file to disk :wq → write the file to disk, then quit :q → quit the file (only works if no changes) :q! → quit and lose any changes made :w! → override r/o file permission if you are owner or root and write the file to disk. :w!q → override r/o file permission if you are owner or root and write the file to disk and quit.

Speed-Up your config file editing! 1. In vi press the ESCape key to verify you are in command mode. 2. To search for the first occurrence of something: /string → press “n” → press “n” for each following occurrence “N”→ press “N” for each previous occurrence 3. To replace all occurrences of a string in a file: :%s/old_string/new_string/g 4. To replace all occurrences of a string in a file: :%s/old_string/new_string/gc

Speed things up some more! 1. In vi press the ESCape key to verify you are in command mode. 2. Go directly to a specific line number :NN → press. If NN=100, go to line Go to start/end of a line press Home or press End on your keyboard 4. Go to top/bottom of a file: press ctrl-Home or press ctrl-End on your keyboard 5. Undo the last change you made (in command mode) press “u”

Other editors joe - Ctrl-k-h brings up the editor menu - Ctrl-c aborts - Cursors work as you expect ee - ESC brings up the editor menu - Cursors work as you expect

Conclusion vi's most confusing feature is that it works in two modes and you must switch between them. Questions?

Some vi practice