With gunzip its simply zip -r archive.zip my_dir/
.
Am failing to find an equivalent command for bunzip. Some if found are zipping individual files inside of a directory, but i want one .bzip2 archive.
Asked
Active
Viewed 7,049 times
3

osgx
- 90,338
- 53
- 357
- 513

Pratik Khadloya
- 12,509
- 11
- 81
- 106
-
2`bzip2` only compresses individual files, which is why many people use `tar` to archive the files first. Also, `zip -r` is a completely different command from `gunzip`; one operates on `.zip` files and the other operates on `.gz` files. – Colonel Thirty Two Jul 31 '14 at 17:42
-
1tar -jcvf archive_name.tar.bz2 directory_to_compress – George Hazan Aug 12 '17 at 08:58
1 Answers
4
gunzip
is not zip
. zip
is an archiver which handles files and directories. gzip
/gunzip
only compresses a single file or stream of data.
bzip2
is just like gzip
, and only compresses a single file or stream of data. For both gzip
and bzip2
, it is traditional to use tar
as the archiving program, and compressing the output. In fact that is such a common idiom that tar
has options to invoke gzip
or bzip2
for you. Do a man tar
.

Mark Adler
- 101,978
- 13
- 118
- 158