[olug] firewall dump

Mark A. Martin mmartin at amath.washington.edu
Mon Sep 25 11:01:53 UTC 2000


Dear Gary,

(Please read this entire message before trying to fix your file.)

I thought that you told us that there are 160-some lines in the file. 
How did it suddenly grow to more than 200,000?  I'd think about that
question before tackling the edit.  If the file became corrupted in some
strange way, you might want to recreate it rather than trying to edit
the corrupted version.

This brings up an important point.  Always make a copy of a critical
file before editing it.  In fact, some systems administrators keep
copies of all previous revisions of important system files and give them
names like filename.n, where n is the number of the revision.  That way,
you can look through previous versions of a file to see how it has
evolved and you can go back to whatever version you like, if necessary.

There's more to emacs help than you have gleened.  Try "info emacs" for
the entire manual.  The printed emacs manual is good and is available
from the Free Software Foundation (http://www.gnu.org), some book
stores, or probably Amazon.com or bn.com.  Also, the O'Reilly book
"Learning GNU Emacs" is excellent.  You shouldn't buy a book to edit one
file but you could get one from the library and you need to become more
proficient at helping yourself.

If you're using an X-based version of emacs, there should be a scroll
bar on one side of the window that you can use to navigate the file and
you should be able to move the cursor using the arrow keys and the
mouse.  The X-based version also has menus at the top of each window
that allow you to perform many tasks.

Whether there's a scroll bar or not, M->, meaning meta - greater than,
will get you to the end of the file.  The meta key is usually Esc or
Alt.  To type M->, either press Esc first, then >, or hold Alt down and
press >.  M-< will take you to the beginning of the file.  To delete a
contiguous set of lines, you must "set the mark" at the top or bottom of
the set by pressing Ctl-space with the cursor at the beginning of the
section you want to delete, move the cursor to the end of the set, and
then press Ctl-w (That's holding the Control key down and pressing w at
the same time.).  Ctl-underline is undo.  Emacs will undo an unlimited
number of actions.  You might practice with emacs on a test file before
trying to edit critical system files.

I have only given you a very small subset of the navigational key
sequences in emacs.  Spend more time with the manual and try what you
read to learn other navigational sequences.

If you're more comfortable with vi, use vi.  The commands that I will
describe must be executed from command mode (not insert or append
mode).  A number followed by G (not g) will take you to that line
number.  G without a number preceding it will take you to the end of the
file and 1G will take you to the beginning of the file.  You can delete
a line by placing the cursor on the line and hitting dd.  If you place
the cursor on a line and want to delete from that line to the end of the
file, press dG.  You can delete a number of lines starting with the line
that the cursor is on by hitting the number followed by dd.  vi will
undo the last action if you type u.  Unlike emacs, vi has only one level
of undo and hitting u a second time will only undo your previous undo. 
(In contrast, vim has multiple levels of undo.)

As with emacs, I have described only a small subset of the available
commands.  See the online help by typing :help from command mode in vi
for more information.  There are also reasonable vi reference sections
in the O'Reilly books "Linux in a Nutshell" and "UNIX in a Nutshell" and
there is a small O'Reilly book that specifically covers vi (I don't
remember the title because I have never used it.).  These O'Reilly books
are available at most Barnes and Noble and Borders stores and may be at
the library.

The moral to this entire saga is that you need to learn to use at least
one editor better.  It was not understanding pico that got you into this
situation in the first place.  (Also, I suspect that you made another
mistake with an editor, possibly hexedit, that inflated your file to
over 200,000 lines.)  This takes practice and can't be solved by
following the steps for correcting a single file that someone gives you
in an email.

I suggest that you pick one editor and learn everything that you can
about it.  Either emacs or vi (or vim) would be a good choice.  (I don't
recommend pico because you won't find it on as many systems and it
doesn't have as many features or as much documentation.)  One way to do
this would be to open the appropriate help, man, or info page in one
window while you try commands out on a test file in another window.  Or
get a copy of one of the books I mentioned and read it while trying the
commands on a test file.  Personally, I learned emacs from the printed
emacs manual and "Learning GNU Emacs" and I learned vi from a very old
book called "UNIX by Example" and from the reference sections in the
nutshell books.

Editing is one of the most fundamental tasks required for using Linux
effectively and it would be more productive for you to take the time to
learn it well before you spend more time working on advanced topics such
as firewalling.  All of us had to invest the time to develop this
critical skill before attempting more complicated tasks and you should
too.

Good luck,

Mark
-- 
---------------------------------------------------------------------------
Mark A. Martin					Dept of Applied Mathematics
http://www.amath.washington.edu/~mmartin	University of Washington
---------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: olug-unsubscribe at bstc.net
For additional commands, e-mail: olug-help at bstc.net



More information about the OLUG mailing list