Corrupt dhcpd.conf file

Simon Hobson dhcp1 at thehobsons.co.uk
Wed Jan 6 20:56:27 UTC 2010


Glen R. J. Neff wrote:

>Honestly though, I'd get a copy of 'vilearn' and just learn vi.  You 
>can be a vi expert in give easy lessons.  There's nothing faster or 
>easier, once you give it a little time.

Expert in five easy lessons ? I'd say that anyone who is happy 
managing a DHCP config of that complexity can lean the basics of vi 
in a few minutes - but I believe it's one of those "learned in an 
hour, mastered in a lifetime" things (like backgammon).

Certainly I've managed to teach our helpdesk people the basics of vi 
- they've stopped asking how to quit without saving now :-/


Actually, I think the basic commands you need to know are just :

(from the shell) "vi filename" to edit file called filename

i - insert (before current char), a - append (after current char), 
esc to exit insert/append mode
x - delete char under cursor, dd - delete current line
o - new line after current, O - new line before current

:q! - quit without saving, :x - save and exit
:x! - force save (override permissions if you are root)

That's ten commands that will allow you to do basic editing. Commands 
that start with ':' are ones where you type in a command string and 
it appears at the bottom of the screen - hit enter to execute it. The 
rest are instant.


Getting more useful :
A - Append at end of line, I - insert at beginning of line
r - replace for single character, R - replace until you exit
u - undo single edit, U - undo all changes on current line
nG - goto line n in file, G - goto end of file
. - repeat last edit (that's a single full stop)
:w - write file without exiting

Search :
/string - search forwards for string, ?string - search backwards for string
n - find next
:g/string1/s//string2/g - find all occurrences of string1 and replace 
them with string2, without the 'g' on the end only changes first 
occurrence on a line

I'd say that accounts for probably 99% of my editing in vi

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list