Help Using The Tar Command
Hello,
Need a little help with the Tar command. Just need to make sure what I have listed below is going to do what I need. tar -pcvjf backups/tarbackupname.$DATETIME.tar.bz2 html/ > /dev/null 2>&1 Directory structure /home/virtual/site1/var/www/html/(all the web files and directories) I would like to tar all files and folders from the html directory and down. Also want to keep the file permissions, which I think is the -p? Where I get lost, if I want to tar all files and folders under html/, do I run the command in the html folder, or one above in the www folder. Also, which ever folder I do run the command, I would like the tar file to be created in that folder where it is executed. Thanks JR |
Quote:
Quote:
So with your current example, because you use 'html/' you would need to be in the directory directly above as this is a relative path as opposed to an absolute one which starts at root (/) down to location. Quote:
|
@gaspower
You can run tar command from anywhere you like as long as path at where you want to save tar file and path of which you want to take backup are correct. Just keep in mind that when you want to restore (untar) them, where do you want to put those files (the one you backed-up)... does matter. Generally, when you want take backup of system files, and you want to restore them at the place where they originally belonged, then tar them with absolute path. Other than this, if you want to take backup of files/folders and want to restore them in which-ever folder you like, then tar them with relative path. please refer http://www.linuxquestions.org/questi...2/#post4997953 Original Source: Beginning the Linux Command Line - Sander van Vugt. Page 57. |
All times are GMT -5. The time now is 08:50 AM. |