I would like to compress a text file using gzip command line tool while keeping the original file. By default running the following command
gzip file.txt
results in modifying this file and renaming it file.txt.gz
. instead of this behavior I would like to have this new compressed file in addition to the existing one file.txt
. For now I am using the following command to do that
gzip -c file.txt > file.txt.gz
It works but I am wondering why there is no easier solution to do such a common task ? Maybe I missed the option doing that ?