Return to Snippet

Revision: 9583
at November 14, 2008 14:43 by melvitax


Updated Code
# archive
tar -zcvf backup.gz public_html  

# copy archive to current directory
wget http://urlpathto/backup.gz

# compy archive to mac
curl -c -o "http://urlpathto/backup.gz"

# restore to current directory
tar -zxvf backup.gz

Revision: 9582
at November 12, 2008 18:06 by melvitax


Updated Code
# archive
tar -zcvf backup.gz public_html  

# copy archive to current directory
wget http://urlpathto/backup.gz

# restore to current directory
tar -zxvf backup.gz

Revision: 9581
at November 12, 2008 17:03 by melvitax


Updated Code
# archive
tar -zcvf backup.gz public_html  

# restore to current directory
tar -zxvf backup.gz

#restore to other folder
tar -zxvf backup.gz -C /pathtofolder

Revision: 9580
at November 12, 2008 16:58 by melvitax


Initial Code
You need to use tar command as follows (syntax of tar command):

tar -zcvf archive-name.tar.gz directory-name

Where,
-z: Compress archive using gzip program
-c: Create archive
-v: Verbose i.e display progress while creating archive
-f: Archive File name
For example, you have directory called /home/jerry/prog and you would like to compress this directory then you can type tar command as follows:
$ tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
Above command will create an archive file called prog-1-jan-2005.tar.gz in current directory. If you wish to restore your archive then you need to use following command (it will extract all files in current directory):
$ tar -zxvf prog-1-jan-2005.tar.gz
Where,
-x: Extract files
If you wish to extract files in particular directory, for example in /tmp then you need to use following command:
$ tar -zxvf prog-1-jan-2005.tar.gz -C /tmp
$ cd /tmp
$ ls -

Initial URL
http://www.cyberciti.biz/faq/how-do-i-compress-a-whole-linux-or-unix-directory/

Initial Description
copied straight from the source

Initial Title
Unix GZIP backup

Initial Tags
unix

Initial Language
Bash