What is the command to compress a folder on Ubuntu 10.04 (Lucid Lynx) server?
Asked
Active
Viewed 2,135 times
2 Answers
5
tar -czvf archivename.tgz foldername

Sven
- 98,649
- 14
- 180
- 226
-
but i want to ask you if i want to compress file i will use the same command ? – Mohammad AL-Rawabdeh Sep 05 '10 at 10:30
-
Yes, you can also compress single files like this. Please read `man tar`. – joschi Sep 05 '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 05 '10 at 10:49
-
1Replace `z` with `j` (use *bzip2*) or `J` (use *xz*) to get a better compression ratio (most of the time). – Cristian Ciupitu Sep 05 '10 at 12:27
0
“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 it's more appropriate to send Mohammad our friend here to the 'man' program.
man -k 'string'
searches the man database for programs with the needed string.
So for the next time:
man -k compress
It would also print out for tar.
And man tar
will teach him all he needs to know about compressing and uncompressing.

Peter Mortensen
- 2,318
- 5
- 23
- 24

abutbul
- 71
- 6
-
4ServerFault (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 08 '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