Codeigniter, Nginx and Postgres for noobies like me.
HowTo tar and untar gz archives from shell
April 07, 2009 in Linux by ElToro
I do not need tarring too often and when I do I can not remember how those tar flags needed to be to get what I wanted. Even man pages fails to view the most common use cases to tar and untar.
Create gzipped tar archive from commandline
Assuming you are in shell and production_folder is the folder you want to tar and gzip.
tar czvf my_backup.tar.gz production_folder/
This will create a my_backup.tar.gz archive for you.
Untar gzipped tar archive from commandline
This command will untar the my_backup.tar.gz to current folder, usually tar contains "root" folder where all files are.
tar xzvf my_backup.tar.gz
Thumb rule how to remember
You always need atleast zf parameter and those letter stands for:
- z = to use gzip / gunzip
- f = file to archive / unarchive
- v = verbose list files processed, not needed but you can see what is happening
Then the variating part in the beginning is:
- c = create new archive
- x = extract files from archive
Simple uh, but so hard to remember, hopefully this post makes you remember too
Leave a reply
Feel free to share your thoughts about this entry.
|
|
|