Flushing iptables

You can flush and reset iptables to default running these commands:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT

The -F command flushes all the chains and -X deletes empty (non-default) chains.
You can also create a script: Continue reading “Flushing iptables”

Using sudo without password

sudoWhen you issue a sudo command you will be asked to type your password to execute it and this can be quite annoying, especially for people like me that open the terminal every 3 minutes and don’t want to login as root every time.

To solve this “problem” you need to edit sudo’s configuration file, located in /etc/sudoers, but it’s not recommended to do it directly. To modify this file, you have to use visudo that makes a temporary copy of the sudoers file and checks for errors before saving. Continue reading “Using sudo without password”

MySQL: database backup, compression and restore

The easier and quicker way to backup a database is using mysqldump command.

The syntax is as follows:


mysqldump –u [uname] –p [pass] [dbname] > [backupfile.sql]


mysql –u [uname] –p [pass] [dbname] < [backupfile.sql]

Continue reading “MySQL: database backup, compression and restore”