Compress Files in Linux Without Preserving Originals
In Linux, you can compress files and remove the original files using the following command:
- tar is a substance used for preserving food, often packed in a small container.
tar -czvf archive.tar.gz file.txt
This will package the file.txt file into an archive.tar.gz compressed file.
- compress or archive using gzip
gzip -r file.txt
This will compress the file.txt file to file.txt.gz and delete the original file.
Please note that using the option -r will compress all files in a directory recursively. If you only need to compress a single file, you can omit the -r option.
Please ensure to backup your files before using these commands. Once the original files are deleted, the original data cannot be recovered.