gzip command line usage
To gzip a file while keeping a copy of the original file use the following command:
gzip -c -- file1.ext > file2.ext.gz
Also, you can define a shell function with the following code:
function gzipkeep {
if [ -f "$1" ] ; then
gzip -c -- "$1" > "$1.gz"
fi
}
and then
gzipkeep file.txt
Add new comment