Using GZIP command

Hi All,

Is it possible to redirect the o/p of gzip command to another file?

I need to store the o/p in a separate file

Regards,
sh_kk

for example, you need gzip a folder,

tar cvf - FOLDER_NAME |gzip > /PATH/Separete_file.tar.gz

man gzip

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

with GNU tar you can do:

tar zcvf files.tar.gz file1 file2

And of course you can put the stdout of the command in a separate file if that is what you mean

tar zcvf files.tar.gz file1 file2>files.out

Hi All,

Am getting following error while executing gzip:

/$HOME/A >> gzip > /$HOME/B

Getting error :
./shell: line 38: //home/XYZ/A: Permission denied

Permission are:

-rw------- 1 XYZ XYZ 15636480 Nov 21 03:31 A

Any idea why is this happening?

You are trying to execute //home/XYZ/A and appending the output to the file gzip and then there are some more statements, but unfortunately //home/XYZ/A is not executable.

^^

Thank you for replying.

Here is what I am trying to do.

I have made a set of files and want to archive all of them.

1 > I pass all the files to PAX command and store the o/p in a file pax_x.

2 > Now, I need to pass this file pax_x to gzip and store that o/p in gzip_x instead of a .gz file.

I am not sure the use of tar command above.

Please help me out on this.

You mean like this?

pax -w file1 file2 |gzip > pax_x