I'd like to compress one huge file (~200GB) from the command line. no need for archiving its directory along with it, swift operation and high compression ratio preferred. What may be some good ways?

  • Depends on what is the contents of the file, whether speed or size is more important and other things. Other than that, you can use any command line utility like gzip, bzip2, xz, lzma, zip, 7z, rar, ... there's plenty to choose from. – peterph Jan 15 '15 at 12:31
  • 200 gb is a big file, i think a faster compress algorithm is better. you can compare some compress algorithms and choose a proper compress tool to do that. – zhangjie Jan 15 '15 at 12:44
  • -1 for “best”. On the majority, there isn't a best way to do things under *nix. As @peterph mentioned, what works well varies greatly depending on what you actually want to happen. Without a lot more detail about what you want, there is no “best” option. – HalosGhost Jan 15 '15 at 12:47
  • 1
    About mksquashfs: link and link. – mikeserv Jan 15 '15 at 12:48
  • 7z on an i7 took: real 147m3.783s user 243m1.971s sys 5m29.123s – Matan Jan 15 '15 at 15:03

I would recommend to use 7z.

7Z is 7-Zip's archiving format, providing high compression ratio through powerful compression algorithms that can take benefit of parallel computing on modern multicore CPUs.

To make 7z archive you need p7zip-full package. To make archive run 7z a <you_archive_name>.7z <filename>

| improve this answer | |
  • 1
    7z will require a lot of /tmp space for a file of that size. – mikeserv Jan 15 '15 at 12:09
  • I have it in the answer: 7z a <you_archive_name.7z <filename> – kirill-a Jan 15 '15 at 12:14
  • I think you mean <you_archive_name.7z> though, rather than really <you_archive_name.7z there. Anyway is not really leveraging more than just two cores out of many idle ones... – Matan Jan 15 '15 at 12:35
  • @mikeserv where can I apt-get or get mksquash? can it by any chance help backup a disk partition? – Matan Jan 15 '15 at 12:38

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