On Thu, 23 Apr 2009 00:23:35 +0300 James Matthews wrote:
How do you get bzip2 to compress directories?
use tar.
tar cvjf mydirectory.tar.bz2 mydirectory
That will tar and bzip2 the directory called mydirectory and leave you with a file named mydirectory.tar.bz2
Hi,
On Wed, Apr 22, 2009 at 17:23, James Matthews nytrokiss@gmail.com wrote:
How do you get bzip2 to compress directories?
You use "tar" to create a tar with the directory contents, and then bzip2 to compress that tarfile.
You can use the "-j" option of tar to bzip2 on the fly.
This is probably what you want:
$ tar -cvjf filename.tar.bz2 dirname/
Replace "filename" and "dirname" with something that is appropriate to you.
HTH, Filipe
At Wed, 22 Apr 2009 17:30:51 -0400 CentOS mailing list centos@centos.org wrote:
Hi,
On Wed, Apr 22, 2009 at 17:23, James Matthews nytrokiss@gmail.com wrote:
How do you get bzip2 to compress directories?
You use "tar" to create a tar with the directory contents, and then bzip2 to compress that tarfile.
You can use the "-j" option of tar to bzip2 on the fly.
This is probably what you want:
$ tar -cvjf filename.tar.bz2 dirname/
Replace "filename" and "dirname" with something that is appropriate to you.
Note that is also possible to use dump or cpio as well. Unlike the MS-Windows zip/unzip, which combines compressing and archiving in a single program, the 'UNIX' way is to separate these functions. bzip2 only compresses. Other programs (tar, dump, cpio) create archives -- bundle a group of files and/or directory trees into a single file.
HTH, Filipe _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Wed, 22 Apr 2009 19:29:52 -0400 Robert Heller wrote:
Note that is also possible to use dump or cpio as well. Unlike the MS-Windows zip/unzip, which combines compressing and archiving in a single program, the 'UNIX' way is to separate these functions. bzip2 only compresses. Other programs (tar, dump, cpio) create archives -- bundle a group of files and/or directory trees into a single file.
Depending on your needs, you can obtain better compression with programs other than bzip2. The price paid for the additional compression can be processing time, ram requirements, robustness, compatibility and several or none of the above.
rzip, lzip and 7za come to mind as alternatives that you may want to look into.
Frank Cox wrote:
On Wed, 22 Apr 2009 19:29:52 -0400 Robert Heller wrote:
Note that is also possible to use dump or cpio as well. Unlike the MS-Windows zip/unzip, which combines compressing and archiving in a single program, the 'UNIX' way is to separate these functions. bzip2 only compresses. Other programs (tar, dump, cpio) create archives -- bundle a group of files and/or directory trees into a single file.
Depending on your needs, you can obtain better compression with programs other than bzip2. The price paid for the additional compression can be processing time, ram requirements, robustness, compatibility and several or none of the above.
pbzip2 is available too if you have more than 1 cpu core: http://compression.ca/pbzip2/
Though I prefer pigz(parallel gzip), both pbzip2 and pigz are completely compatible with regular bzip2 and gzip.
bzip2 is reallly slow, but if you happen to have a 8 core or better system you can get some pretty good speed out of pbzip2, though in both cases the parallellness is only available on compression not on decompression(last I checked).
I've been using pigz on a daily basis to backup databases for more than a year now, I always run gzip -t afterward as part of the backup script and so far have never had an error.
nate
Robert Heller wrote:
Note that is also possible to use dump or cpio as well. Unlike the MS-Windows zip/unzip, which combines compressing and archiving in a single program, the 'UNIX' way is to separate these functions. bzip2 only compresses. Other programs (tar, dump, cpio) create archives -- bundle a group of files and/or directory trees into a single file.
zip and some of the other compression tools also have a habbit of not preserving file system permissions or ownership, which can be handy in a backup, also may not support special devices(e.g. sockets, fifos, character/block device entries etc). If you rely upon file system ACLs on top of regular unix permissions things might get more complicated, I don't use ACLs, so don't have experience with preserving them in archives.
nate
At Wed, 22 Apr 2009 16:51:33 -0700 (PDT) CentOS mailing list centos@centos.org wrote:
Robert Heller wrote:
Note that is also possible to use dump or cpio as well. Unlike the MS-Windows zip/unzip, which combines compressing and archiving in a single program, the 'UNIX' way is to separate these functions. bzip2 only compresses. Other programs (tar, dump, cpio) create archives -- bundle a group of files and/or directory trees into a single file.
zip and some of the other compression tools also have a habbit of not preserving file system permissions or ownership, which can be handy in a backup, also may not support special devices(e.g. sockets, fifos, character/block device entries etc). If you rely upon file system ACLs on top of regular unix permissions things might get more complicated, I don't use ACLs, so don't have experience with preserving them in archives.
dump and *GNU* tar handle special files properly. dump preserves all ext2/ext3 permissions, etc. Also preserves hard and soft links.
nate
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Wed, Apr 22, 2009 at 2:23 PM, James Matthews nytrokiss@gmail.com wrote:
Hi,
How do you get bzip2 to compress directories?
* All the files in a dir? ( you cannot compress the directory itself).
Try: find dir -type f -print | xargs bzip2 -v or find dir -type f -print0 | xargs -0 bzip2 -v or cd dir; bzip2 *
Do you want to Package all the files into a tar or cpio archive so you can send it to someone else?