In Linux there are different shell types:
||GNU bourne again ahell
||based on C shell
||evolution of Korn shell
/bin/sh is a pointer to system default shell (/bin/bash). On Ubuntu /bin/sh points to the dash shell.
Continue reading “Command line ultra basic reference”
Here’s how to setup SSH key authentication, in case you’ve grown tired of typing every time your remote host password.
First, you have to generate the key pair, a public key (.pub) and a private key, with ssh-keygen. This command can create DSA, ECDSA, ED25519 or RSA keys using the -t option. If no argument is specified, it’ll create an RSA key.
ssh-keygen -t rsa
Continue reading “Linux 101: SSH keys”
You can flush and reset iptables to default running these commands:
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT 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”
When 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”
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”