shell script to backup files and directories in Linux using tar & cron jobs

The vi Editor http://t4test.com/blog/unix-linux-shell-script-introduction-to-shell-scripting/ http://t4test.com/blog/read-making-shell-script-interactive/ http://t4test.com/blog/cpio-a-backup-program/ Backup Using TAR Backing up your files using tar is very simple you just type a little command. tar -cvpzf /BackupDirectory/backupfilename.tar.gz /ImportantData/directory/path Let’s suppose i have directory called /imp-data on root and i want to make backup of this directory including sub directories on different location like in /mybackupfolder. … Read more

shell script to get yesterday’s date into a variable

a shell script which does the following to store the current day’s date in a variable ‘dt’: date “+%a %d/%m/%Y” | read dt echo ${dt} How would i go about getting yesterdays date into a variable?

Find out Gateway / router IP address under Linux / UNIX using route command

You need to use route command. This command can manipulates the kernel’s IP routing tables. It can be also use to print gateway / router IP address. Type the following command to see default gateway: $ route -n Output: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.10.54 0.0.0.0 255.255.255.0 U … Read more

Shell script to show calender

Use your vi  editor to create shell script, script.sh . This script runs three echo commands and shows the use of variable evaluation and command substitution. It also prints the calender of the current month. #!/bin/sh echo “Today’s date : `date` ” echo “This month’s calender:” cal `date “+%m 20%y` echo “My shell : $SHELL” … Read more

VI editor – Linux command line editor

http://blog.eduguru.in/linux-2/the-vi-editor http://t4test.com/blog/unix-linux-shell-script-introduction-to-shell-scripting/ http://t4test.com/blog/cpio-a-backup-program/ http://t4test.com/blog/read-making-shell-script-interactive/ http://t4test.com/blog/root-system-administrator-super-user-part-1/ http://t4test.com/blog/etchosts-the-host-file/ VI editor  VI operates in three modes for performing different functions. —-The Command Mode is used to enter commands that operates on text or control cursor motion. —-The Input Mode is used to enter text. —-The ex Mode (or last line mode) is used for line handling and substitution. … Read more

Find Linux RAM Information Command and system information

  You need to use the free command: # free # free -m total used free shared buffers cached Mem: 7930 4103 3826 0 59 2060 -/+ buffers/cache: 1983 5946 Swap: 15487 0 15487 For system information: You need to use the dmidecode command: # dmidecode –type 17 OR # dmidecode –type memory OR # … Read more

Mount.cifs cannot allocate memory mounting

Mounting a Windows (SMB) share on Ubuntu gives us a “cannot allocate memory” error. Executing a command like this: mount -t cifs //toad/Backup /media/backup -o user=username,password=password,iocharset=utf8,file_mode=0777,dir_mode=0777 We get an error like this: mount error(12): Cannot allocate memory Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) Solution: First, check the permissions on your shared folder. … Read more

Startup: Unable to load dynamic library ‘/usr/lib/php/modules/module.so’

this error come up while running a shell script to get the parameter from php file PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/module.so’ – /usr/lib/php/modules/module.so: cannot open shared object file: No such file or directory in Unknown on line 0  This is cause by mcrypt extension. Edit /etc/php.d/mcrypt.ini and change ; Enable … Read more