Tool to compress/decompress STDIN

vikarjramun

Is there a tool that compresses STDIN, and outputs to STDOUT? This tool (or its counterpart) should be able to decompress as well. Something simple is fine, but it must be lossless.

Downgoat

gzip

Most utilities support outputting to STDOUT. Take for example gzip:

$ echo "asdgasdfasdfasdfasdfasdfasdf" | gzip | xxd
00000000: 1f8b 0800 219b dd57 0003 4b2c 4e49 4f2c  ....!..W..K,NIO,
00000010: 4e49 c386 b900 45ce f97c 1d00 0000       NI....E..|....

I've used xxd as some unprintable characters exist. Run it through gunzip to decompress

xz

xz works pretty similarially:

$ echo "asdfasdfasdf" | xz | xxd
00000000: fd37 7a58 5a00 0004 e6d6 b446 0200 2101  .7zXZ......F..!.
00000010: 1600 0000 742f e5a3 e000 0c00 0b5d 0030  ....t/.......].0
00000020: 9cc8 abf9 a8be f900 0000 0000 9525 d79a  .............%..
00000030: 089a c592 0001 270d f37b f284 1fb6 f37d  ......'..{.....}
00000040: 0100 0000 0004 595a                      ......YZ

and for decompress:

$ echo "asdfasdfasdf" | xz | xz -d
asdfasdfasdf

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related