Results 1 to 2 of 2

Thread: Using Tar in linux to make a backup

  1. #1

    Using Tar in linux to make a backup

    This is just a small example of how you can use the TAR application with linux to generate a powerfull backup script triggered by a cron.

    You will need to create an archive , either using vi or touch.

    For example in this case lets say our script is called backup

    vi backup

    This will create the archive and open the vi editor, to add content to the archive press the I key to insert and then check out at my example here:

    #Beggining of script
    # Lets say you want to remove an old backup on autobackups folder
    rm /autobackups/mybackup*.*
    # Now lets say you want to make the script sleep for 3 seconds
    sleep 3

    #Now you want to backup /home entirely into /autobackups using tar

    tar -cvf /autobackups/home$(date +%y%m%d).tar /home


    Please notice that you are creating a tar archive with the whole content of /home and adding the date of the backup to the name of the archive. To execute this script, you need to save it , on VI press ESCAPE , then activate the CAPS LOCK and press the Z key 2 times. (zz)

    You will need to give the archive execute permissions, use the following command: chmod a+x backup , basically to run the script just type ./backup considering you are on the same path of the archive. Easy does it

  2. #2
    Junior Member
    Join Date
    Sep 2006
    That was a good information, Thanks!!

Similar Threads

  1. make backup/image of centos5 to install on new server
    By beemer832 in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 10-22-2010, 05:49 AM
  2. How to Make Backup Copy of Wall-E DVD Movie
    By ellaine09 in forum Windows - General Topics
    Replies: 1
    Last Post: 04-13-2009, 08:18 AM
  3. Linux Backup Recommendation?
    By beatlejuice321 in forum Linux - General Topics
    Replies: 2
    Last Post: 08-23-2002, 02:04 AM
  4. creating a backup image of your linux drive?
    By in forum Linux - General Topics
    Replies: 7
    Last Post: 12-31-2001, 02:30 PM
  5. Replies: 3
    Last Post: 07-29-2001, 12:18 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts