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
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
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.
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.
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.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Privileges: who can control what Introduction to Unix May 24, 2008 Rabat, Morocco Hervey Allen.
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
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
Getting Started with Linux Linux System Administration Editors.
CS:414 introduction to Unix and Linux
SUSE Linux Enterprise Desktop Administration
Vim basics Vi IMproved.
Guide To UNIX Using Linux Third Edition
Editing, vi and Configuration Files
Vi Editor.
Unix Fundamentals - Part iii vi Editor
Vim.
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
Unix Systems Administration
Users and Accounts Lab 0.1. Users and Accounts Lab 0.1.
Privileges: who can control what
Document Processing Part 2
Text Editors Vim (Chapter 6) Emacs (Chapter 7)
The Linux Command Line Chapter 12
You do want to create and edit programs?
C151 Multi-User Operating Systems
Run Java file with Window cmd
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
In the last class… The vi basics command, input and ex mode
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
The Linux Command Line Chapter 12
Presentation transcript:

Linux System Administration Editors 02/15/11 Linux System Administration Editors Getting Started with Linux

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: vi has two modes 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 <ENTER>. 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” In vi press the ESCape key to verify you are in command mode. 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! In vi press the ESCape key to verify you are in command mode. To search for the first occurrence of something: /string → press <ENTER> “n” → press “n” for each following occurrence “N” → press “N” for each previous occurrence To replace all occurrences of a string in a file: :%s/old_string/new_string/g :%s/old_string/new_string/gc

Speed things up some more! In vi press the ESCape key to verify you are in command mode. Go directly to a specific line number :NN → press <ENTER>. If NN=100, go to line 100 Go to start/end of a line press Home or press End on your keyboard Go to top/bottom of a file: press ctrl-Home or press ctrl-End on your keyboard 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 02/15/11 joe Ctrl-k-h brings up the editor menu Ctrl-c aborts Cursors work as you expect ee ESC brings up the editor menu

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

Some vi practice