gz/gzip/zcat a file (or multiple files)

No replies
bOtskOOl
Offline
Last seen: 8 years 34 weeks ago
Joined: 2009-02-21
bOt Points: 3500

gzip a file

     $ gzip foo      

decompress

    $ gzip -d foo

Compress all files in folder

    $ gzip -r foo

{Note that gzip doesn't compress a folder, it can compress only files}

gzip two/more files together

    $ gzip -c file1  > foo.gz
     $ gzip -c file2 >> foo.gz

gunzip -c foo is equivalent to cat file1 file2

Option1 {better compression}
             cat file1 file2 | gzip > foo.gz
Option2
             gzip -c file1 file2 > foo.gz