Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 123 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 129 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 136 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 170 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 200 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 206 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 231 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 242 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 254 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 293 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 351 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 352 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 353 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 354 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 355 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_main.inc.php on line 571 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_misc.funcs.php on line 197 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_misc.funcs.php on line 202 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_connect_db.inc.php on line 27 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/generic/_genericelement.class.php on line 112 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/dataobjects/_dataobject.class.php on line 428 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/dataobjects/_dataobject.class.php on line 437 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/collections/_category.funcs.php on line 390 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_resultsel.class.php on line 549 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_resultsel.class.php on line 563 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/items/_itemlist.class.php on line 602 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/items/_item.class.php on line 2952 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_plugins.class.php(3113) : eval()'d code on line 1 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_plugins.class.php(3113) : eval()'d code on line 1 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_misc/_plugins.class.php(3113) : eval()'d code on line 1 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_blog_main.inc.php on line 306 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/items/_itemlist2.class.php on line 120 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/items/_itemlist2.class.php on line 796 Deprecated: Function ereg() is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/_blog_main.inc.php on line 413 Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/items/_itemlist.class.php:602) in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/inc/MODEL/skins/_skin.funcs.php on line 71 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 528 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 541 Malta Web Design | Web Hosting | E-Commerce | SEO - Brief introduction to the vi Editor

Brief introduction to the vi Editor

02/08/07

Permalink 08:10:00 am, by ANG Malta Email , 647 words, 62925 views   English (US)
Categories: UNIX and Linux

Brief introduction to the vi Editor

The use of VPS/VDS (Virtual Private Servers or Virtual Dedicated Servers) on the Internet is becoming quite popular, and the large majority of these run Linux distributions.

The normal, day to day administration is done through browser based interfaces, such as Plesk, however, you also can use shell access to administer the server, where you can have total control over the server via a secure SSH connection using a program such as Putty. (available for download free from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)

This type of server administration is also very popular, allowing for work to be done remotely across the internet in a safe way.

Putty’s normal use is text based command line administration, although remote graphical interface administration is also possible.

Definitely when you are administering a Linux (or UNIX) server remotely through a command line interface you will need to use a text editor. Linux comes with a wide range of text editors, however, the most popular are vi and emacs. This article gives a very brief introduction to vi.

[More:]

The vi editor was developed in 1976 by Bill Joy at the University of California. An enormous amount of text based and graphical based editors came out from that time, however, the vi is still very popular amongst the Linux / Unix users.

To open vi there are several ways. The simplest is to type ‘vi’ and press enter. This opens vi and creates a new file. The second way of opening vi is to type ‘vi filename’ where filename is the name of the file that you want to edit. This opens vi, and then opens the file you want to edit in it.

When you open vi, you will have a box at the top, representing the cursor. The line in the bottom will give you useful information regarding what operation you are currently doing. Empty lines are marked with a starting ‘~’ character.

There are two operating modes, command and input. When started, vi will be running in command mode. In command mode, vi will consider your input as commands, and when in input mode, vi will consider what you type as text in the file. Always remember that you are working in a case sensitive environment – heLLo is different from Hello.

To start inserting text, you can use the following two commands:

  • ‘a’ – Add command. Text will be inserted to the right of the current cursor position
  • ‘i’ – Insert Command. Text will be inserted starting from the left of the current cursor position.

Pressing the ‘Esc’ key will take you back into the command mode once you are ready inserting/editing the text in the file.

To exit from vi, use the following commands (remember to press the ‘esc’ key first to go back to command mode) :

  • ‘ZQ’ – Exit without saving the changes
  • ‘ZZ’ – Exit and save the changes

To go around in a document, go in insert mode and use the arrow keys. Most versions of vi also support the PgUP and PgDOWN keys to scroll multiple pages.

To delete text, in insert mode use the normal ‘DEL’ and ‘Backspace’ keys. In command mode, you can use the following:

  • ‘x’ – deletes the character under the cursor
  • ‘X’ – deletes the character before the cursor
  • ‘dw’ – deletes from the current character to the end of the current word
  • ‘d$’ - deletes from the current character to the end of the current line

Other useful commands:

  • ‘u’ – Undo previous change
  • Ctrl+R – Redo previously undone change

To search for text:

  • ‘/example’ – Searches forwards from the cursor position for the word ‘example’
  • ‘?example’ – Searches backwards from the cursor position for the word ‘example’

Other resources

http://www.cs.rit.edu/~cslab/vi.html provides a list of commands available for the vi editor.

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/skins/_feedback.php on line 102 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/skins/_feedback.php on line 223

Trackback address for this post:

http://www.angmalta.net/blog/ang/htsrv/trackback.php/27

Comments, Trackbacks, Pingbacks:

No Comments/Trackbacks/Pingbacks for this post yet...

This post has 2 feedbacks awaiting moderation...

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

Malta Web Design | Web Hosting | E-Commerce | SEO

Providers of complete web presence solutions, including website design, hosting and development. Fantastic prices on Electronic Commerce and Content Management Systems!

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/plugins/_calendar.plugin.php on line 135 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/plugins/_calendar.plugin.php on line 870
November 2014
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/plugins/_archives.plugin.php on line 152 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/angmalta.net/httpdocs/blog/ang/plugins/_archives.plugin.php on line 329

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 3

Subscribe via E-Mail

Enter your email address:

Delivered by FeedBurner

Add our feed to your online news reader:

Add to My Yahoo!
Google Reader or Homepage
Subscribe with Bloglines
Subscribe in NewsGator Online
Add to My AOL
Rss fwd
Add to Technorati Favorites!
Add to netvibes

powered by b2evolution free blog software
Web Design Blogs - BlogCatalog Blog Directory
Blog Directory