Question: When attempting to use gzip on Linux and zip the file - I tried by going to another folder and completing the gzip command as normal. As an example:
Move to another folder , the intended target for the zipped file
Execute code as similar
I discovered it was gzip in the same folder as the source folder. Not zipping the file in the target folder.
Is it possible to gzip and redirect to another folder?
Answer: You need to use the -c switch
So if you need to redirect the zip file to the intended target folder you would execute code similar to the below.
gzip -c filename > /target/location/filename1.Zip