Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Tiny guide to vi basics

Why vi? Because it's available on all Unix and Linux systems and there will be times when you need to navigate and alter files and vi is available and accessible to you when nothing else is.


To enter the vi editor, use the vi command followed by the name of the file you want to edit. If the file doesn't exist, it will be created for you before you leave the editor. If it does exist, the current contents will be loaded into the edit buffer for you. When you enter the vi command and press enter, you'll be presented with a screen that shows the first lines of the current file contents.

Stop at this point. The keyboard in front of you has been transformed from a tool you use to enter whole commands, words and sentences into a function keypad. Each time you press a single key, an action will be taken. You're in vi's command mode. Make sure your caps lock key is OFF. Let's try some commands.
 j will move the cursor down 1 line
 k will move the cursor up one line
 h will move the cursor left one character
 l will move the cursor right one character

If you type in a number before you press the letter key, then instead of moving one character, you'll move by the number you entered. Thus 20j will move you down 20 lines. You'll probably find that the direction keys on your keyboard also work in vi, but that doesn't always happen, so learn the letters. Hint: the four letters are in a line on the keyboard, the h that moves left is on the left and the l that moves right is on the right.

You want to delete a character?
 - Move the cursor over it and press "x".
 - To delete six characters, enter "6x".

To insert characters:
 - Move the cursor to the character before the one you want to insert
 - press "i"...this will take you into insert mode
 - type in your extra text; this can even include new line characters.
 - press the "esc" key to return from insert mode to command mode
the "a" key also enters insert mode, but the text is added after the cursor

It's vital that you understand the difference between command mode and insert mode. In insert mode, typing "Graham" will add the word into the edit buffer. In command mode, you'll:
 - Jump the cursor to the last line of the text
 - Replace the first letter on that line with "a"
 - Try to move the cursor one left, which will ring the bell ....

If you forget which mode you're in, press the esc key and you can then be sure that you're in command mode!

That's bare-minimum vi; there are two other commands you'll need to be able to complete any edit, albeit the most basic.

To delete a line, move the cursor onto it and enter "dd".

CAPITAL letter Z twice to save and exit from vi. To save your work and exit from vi, ensure that you're in command mode and enter "ZZ".


The most basic
 a append (add after cursor)
 dd delete current line
 h move cursor left
 i insert (add before cursor)
 j move cursor down
 k move cursor up
 l move cursor right
 x delete a character
 ZZ save (if necessary) and quit
and one more:
 :e![enter] oops, I made a right mess of that. Restart the edit!

Much more you can do - see the manual pages, the thousands of other resources out there on the net

See also Linux introduction

Please note that articles in this section of our web site were current and correct to the best of our ability when published, but by the nature of our business may go out of date quite quickly. The quoting of a price, contract term or any other information in this area of our website is NOT an offer to supply now on those terms - please check back via our main web site

Related Material

Web Application Deployment - Linux -An Introduction For Users
  [73] - ()
  [74] - ()
  [152] - ()
  [249] - ()
  [430] - ()
  [431] - ()
  [593] - ()
  [659] - ()
  [679] - ()
  [703] - ()
  [710] - ()
  [711] - ()
  [749] - ()
  [984] - ()
  [1012] - ()
  [1013] - ()
  [1068] - ()
  [1259] - ()
  [1287] - ()
  [1288] - ()
  [1366] - ()
  [1408] - ()
  [1438] - ()
  [1527] - ()
  [1651] - ()
  [1764] - ()
  [1803] - ()
  [1893] - ()
  [1897] - ()
  [1902] - ()
  [1904] - ()
  [2201] - ()
  [2203] - ()
  [2299] - ()
  [2300] - ()
  [2479] - ()
  [2494] - ()
  [2636] - ()
  [2831] - ()
  [3179] - ()
  [3256] - ()
  [3791] - ()
  [3819] - ()

resource index - Deployment
Solutions centre home page

You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum.

At Well House Consultants, we provide training courses on subjects such as Ruby, Lua, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/solutions/general- ... asics.html • PAGE BUILT: Wed Mar 28 07:47:11 2012 • BUILD SYSTEM: wizard