I want to gzip two or more files into one file, I checked this and this but both have files like: n1.txt, n2.txt, ... but my filenames are completely different, like: file.mp4, bar.txt, foo.jpeg and I want to gzip them all and put the output into one file. This didn't help too:
gzip -c file.mp4 > test.gz
gzip -c bar.txt >> test.gz
Do I have to tar them first?
And another question: In tar files, we can watch inner files without decompression using:
tar -tvf filename.tar
Is there anyway to do this with gzip or bzip2?
gzip. But it's not very useful since when decompressing such a file withgunzipit will just append all the original files into a single file. If you typeecho Foo > a ; gzip ayou will have a file calleda.gzwhich contains both the name and timestamp of the originalafile. If you then typeecho Bar > b ; gzip b ; cat a.gz b.gz >combined.gzyou will have acombined.gzfile which contains all the information needed to reconstructaandbwith their original names, contents, and timestamps. – kasperd Dec 19 '18 at 15:54