Friday 18 April 2008

vi - text editor - basic commands

Ever since my brother bought me a copy of Red Hat in 1997, I have had a on / off affair with various flavours of Linux. Currently I am using Ubuntu. I am using it as a Server / TV in the front room and as an off site (my garage) backup server for my photos and other important junk.

About a year ago I found the joys of using vi as the editor when editing files in Linux. It's really easy to use and for quick changes to files it is ideal.

Here is a quick guide to ways of doing things in vi:

start vi and open the file named 'filename'.
vi filename


Go into 'insert/edit' mode
Press the 'ins' key or 'i'


Go from 'insert/edit' mode into 'command' mode (To save / close files)
Press 'Esc' key


When in command mode save file (w = write)
Press ':' then 'w' 


When in command mode exit file (q = quit)
Press ':' then 'q' 


When in command mode save file then exit file (w = write then q = quit)
Press ':' then 'wq' 


finally

When in command mode exit file without saving(q! = quit discard changes)
Press ':' then 'q!' 


There are many other commands but the list above should get you going very fast.

Welcome

This is a blog where I will be making notes on programming. Hopefully it will help me and also help you...

I currently use the following technologies (in no particular order!):

  • C#
  • Delphi
  • SQL Server 2000 / 2005
  • PHP
  • MySql
  • Shell Scripting
  • IIS
  • ASP.NET
  • Linux
  • more?