Posts

Showing posts from 2013

Linux Cheat sheet

Basic Operation # hostame - Displays the hostname and/or FQDN of the system # uname -a - Displays the hostname and detailed kernel version # cat /etc/redhat-release - Displays the version of Linux installed Example: # cat /proc/cpuinfo - Displays information about the CPU(s) # df -h - Displays the partitions, their sizes details, and mount points # free - Displays detail about the system memory and usage # lsof - Displays all open files # lsof -nPi: 22 - Displays any open files which use port 22 # locate httpd.conf - Displays the full path to any file named httpd.conf # updatedb - Rebuilds index of files for search using the locate utility Copy, Move, Delete # cp file1.txt file2.txt - Copies file1.txt to file2.txt # mv old.txt new.txt - Renames a file called old.txt to new.txt # rm file1.txt - Deletes file1.txt # mkdir httpds - Creates a new directory called httpds # cp -R httpd httpds - Recursively copies all files from directory httpd t...

Backing up mysql data bases daily,weekly and monthly

I recently find a script that does automatic backup of mysql data bases daily, weekly and monthly bases. Change the name of database e.g in this case is joomla Default backup directory is /var/backup, you can change other if you like. Script:See at bottom. Save the script as autobackupmysql, change permission to execute by #chmod +x autobackupmysql Test the script by executing it #./autobackupmysql Verify the backup at /var/backup, there will be three folders daily, weekly and monthly. Change directory to daily and folder name of your database name e.g joomla, you shall see your database there e.g joomla. Move script to to /etc/cron.daily for autoexecution. Script: #!/bin/bash # # MySQL Backup Script # VER. 2.5 - http://sourceforge.net/projects/automysqlbackup/ # Copyright (c) 2002-2003 wipe_out@lycos.co.uk # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Sof...