Backup site (files) from Shell

Here’s a quick code snippet on how to backup files and restore them from the shell.

To back them up, run the following code:

$ tar -zcvf filename.tar.gz folder/

To backup all files in the directory you are currently in, run:

$ tar -zcvf filename.tar.gz .

Here’s a breakout of the parameters:
z – gzip compression
c – compress the files
v – verbose output (lists the files)
f – file

To uncompress the file(s) (eg. unload to server – overwriting files), use the following:

$ tar -zxvf filename.tar.gz

The key difference is the c in the compress command above was replaced with an x for the extract command.

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *