Recover the MySQL Root Password in Linux

Step 1 - At the linux shell, stop the current mysqld process, start the mysqld_safe process with –skip-grant-tables switch and login as root (no password).

/etc/init.d/mysql stop
mysqld_safe –skip-grant-tables &
mysql -u root

Step 2 - At the mysql shell set the root password and flush privileges.

USE mysql;
UPDATE user SET password=PASSWORD("new-password-here") WHERE User=’root’;
FLUSH PRIVILEGES;
QUIT;

Step 3 - Back at the [...]

Using Rsync over SSH

Prerequisites

First make sure that you are able to login to the remote host using ssh key authentication.

Basic Syntax

To sync files from a local directory to a remote directory use the following syntax:

rsync {options} -e ssh {source} {dest}

Example

Here is an example that exclude all .psd and .fla files:

rsync –exclude *.psd \
[...]

Using tar and gzip to Compress Files and Directories

Create and Compress and Archive
Archive a group of files:

tar -czvf archive.tar.gz file1 file2 file3

Archive an entire directory:

tar -czvf archive.tar.gz directory/

Extract a Compressed Archive

tar -xzvf archive.tar.gz

List the Contents of a Compressed Archive

tar -tzvf archive.tar.gz

Common tar Switches

-c create a new archive
-x extract files from an archive
-t list the contents of an archive
-z filter the archive through gzip
-v [...]

SSH Login Using Public Key Authentication

Step 1: Generate Keypair on Localmachine

ssh-keygen -t dsa

When prompted for a passphrase you can leave it empty to enable logging in without a password (please note that there are potential security issues with doing this).

After confirming your passphrase at the second prompt you’ll find two new files (the keypair) in your ~/.ssh directory. The [...]