Home arrow BrainDump arrow Page 2 - A Look at the VI Editor

Saving and Closing a file - BrainDump

VI is the widely used text editor in UNIX operating systems. I have had the chance to use the VI editor in the Solaris and Linux operating systems. In this article we are going to learn how to use the VI editor.

TABLE OF CONTENTS:
  1. A Look at the VI Editor
  2. Saving and Closing a file
  3. Cursor motion/movements
  4. Undo editing
By: Mamun Zaman
Rating: starstarstarstarstar / 9
August 07, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Use :w for saving the content and :q for quitting. Here are some examples.

:w

Saves current file but doesn't exit

:w file

Saves current content as file but doesn't exit

:n,mw file

Saves lines n through m to file

:n,mw >>file

Saves lines n through m to the end of file

:q

Quits VI and may prompt if you need to save

:q!

Quits VI without saving

ZZ or :wq

Saves and exits VI

VI has two modes; one is the command mode and the other is the edit mode. To change to the edit mode you have to use i (insert) or a (append). Use the ESC character to change back to command mode.

Inserting texts: Use i, I, a, A, o or O for insertion as described in the following table.

i

Insert before cursor

I

Insert before line

a

Append after cursor

A

Append after line

o

Open a new line after current line

O

Open a new line before current line



 
 
>>> More BrainDump Articles          >>> More By Mamun Zaman
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

BRAINDUMP ARTICLES

- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: