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.

 


  • No comments found
Add comment

About Me

Josh Lyon Profile Picture

Name: Joshua Lyon
Birthday: August 8, 1985
Location: Valley Ranch (Irving), TX
E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
ProfilesGoogle, Twitter