Archive for the tag 'Basic'

Understanding basic vi (visual editor)

Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs.

Vim behaves differently, depending on the name of the command (the executable may still be the same file).

vim The “normal” way, everything is default.

ex Start in Ex mode. Go to Normal mode with the “:vi” command. Can also be done with the “-e” argument.

This first line is just to simply open a file with vi:

vi file-name

The following command is used to recover a file that was being edited when the system crashed:

vi -r file-name

The next command will open a file as read-only:

vi ew file-name

To move around in the editor

type h to type move the cursor to the left
type l to move it to the right
type k to move up
type j to move down

To search within VI

To search for text in vi you can use the “/” key followed by your search term. This example uses buddy:

/buddy

To quit and not save changes you can use:

:q!

If you want to quit and save changes you can use the following command:

:x!

Reference : man vi command line

SBDavid

Basic iptables Firewall policies (-P)

Basic iptables Firewall policies (-P)

The following rules block all incoming and outgoing packets on a network gateway:

iptables -P INPUT DROP
iptables -P OUTPUT DROP

Forwarded packets denied. To do this, use the following rule:

iptables -P FORWARD DROP

After setting the policy chains, you can create new rules for your particular network and security requirements.

Establishing basic firewall policies creates a foundation for building more detailed, user-defined rules. iptables uses policies (-P) to create default rules.