Using SCP is a great way to transfer files from one machine to another. SCP uses SSH and can move files to/from localhost remotehost or remotehost remotehost. SCP Syntax: localhost -> remotehost scp /path/to/source-file user@host:/path/to/destination-file SCP Syntax: remotehost -> remotehost scp user@src-host:/path/to/src-file user@dest-host:/path/to/dest-file SCP Examples scp file.txt mydomain.com:~/mydir/file.txt scp local_dir/filename myname@host1:remote_dir scp local_dir/* [...]
To sync your linux server’s time with the NTP Pool Time Servers, use the following command. ntpdate pool.ntp.org If you’d like to sync with a time server weekly, add a new file named ntpdate-sync to /etc/cron.weekly. Then set the file permissions to 755 and set owner:group to root:root. Finally, exit set the file contents to [...]
To “branch” or “tag” within a repository, use svn copy. The syntax is simple. svn copy {SRC} {DST} The source and destination can be either a working copy path or full URL in any combination. So to tag a revision from trunk the following command could be used. svn copy –username myusername –password mypassword http://domain.com/svn/trunk [...]
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’; [...]
To reset the MySQL root password, login to the mysql shell and run the following commands. SET PASSWORD FOR root@localhost=PASSWORD(’RootPasswordHere’); FLUSH PRIVILEGES;
To grant all privileges to a user from any location login to the mysql shell and run the following queries. GRANT ALL PRIVILEGES ON *.* TO username@localhost IDENTIFIED BY ‘PasswordHere’ WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY ‘PasswordHere’ WITH GRANT OPTION; FLUSH PRIVILEGES;
Use Apache’s mod_expires to explicitly set the expiration of a file by it’s type. This will enable to browser to cache these static assets and greatly increase performance. <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "now" ExpiresByType text/html "now" ExpiresByType text/xml "now" ExpiresByType text/css "access plus 8 hours" ExpiresByType text/plain "access plus 8 hours" ExpiresByType application/x-javascript "access [...]
01.10Using 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 [...]
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 [...]
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 [...]
