compress a directory using tar
Hello everyone.
What command do I give to compress an entire directory and it's sub folders to a tar file? I want to log in via ssh, go to inside the directory I want to tar, then issue this command. What exact command do I need to do? Do I need to tar the files first on the old sever? I have searched these forms, and found nothing that would help answer this question. I apologize if this is an easy answer. I am unsure of what to do at the moment and appreciate any help. |
Do
man tar |
(1) cd to the directory you want to tar
(2) choose your output files and directory ... I used /tmp for this example No compression (larger output file): Code:
$ tar cvf /tmp/outputfile.tar . Code:
$ tar zcvf /tmp/outputfile.tar.gz . Code:
$ tar jcvf /tmp/outputfile.tar.bz2 . |
To compress any folder / file
Code:
tar zcvf newtarfile.tar /path/to/folder Code:
tar zxvf newtarfile.tar Code:
tar zxvf newtarfile.tar -C /path/to/extract |
For those who provided examples, thank you very much. Examples are easier to follow than the manual. I learn faster by example as I believe everyone does.
Thank you. |
All times are GMT -5. The time now is 07:03 PM. |