I have the requirement to archive multiple files keeping the original files using tar and gzip. I cannot take risks with the files I have.
For example, the files to be archived are:
ls
1.doc
2.doc
3.doc
4.xls
5.xls
6.xls
The expected output:
ls
1.doc
2.doc
3.doc
4.xls
5.xls
6.xls
archive.tar.gz
Where archive.tar.gz file contains all the doc and xls files.
Did you try the command:
tar czf archive.tar.gz *.doc *.xls
Options here are:
To extract:
tar xzf archive.tar.gz
You can read the manual of the tar command for advanced options:
man tar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With