Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

command to compress folder in ubuntu 10.04 server ?

share|improve this question

2 Answers 2

up vote 5 down vote accepted
tar -czvf archivename.tgz foldername
share|improve this answer
    
but i want to ask you if i want to compress file i will use the same command ? –  Mohammad AL-Rawabdeh Sep 5 '10 at 10:30
    
Yes, you can also compress single files like this. Please read man tar. –  joschi Sep 5 '10 at 10:35
    
To compress just a single file i would use gzip (man gzip), which is implicitly used by the z option in the tar command. –  Sven Sep 5 '10 at 10:49
1  
Replace z with j (use bzip2) or J (use xz) to get a better compression ratio (most of the time). –  Cristian Ciupitu Sep 5 '10 at 12:27

“Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime”

I think its more appropriate to send Mohammad our friend here to the 'man' program.

man -k 'string' searches man database for programs with the needed string so for next time man -k compress would also print out tar

and man tar will teach him all he needs to know about compressing and uncompressing.

share|improve this answer
2  
ServerFault (and all of the StackOverflow communities avoid "RTFM" answers. It is acceptable to provide the answer and also point out that they can find more information (such as the man page.) –  gWaldo Sep 8 '10 at 12:25
1  
@gWaldo--Where is this stated? I feel like it would be appropriate in this instance. –  Josh Brower Sep 12 '10 at 19:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.