How do I create tar.7z file from the command line?
I would like to zip up my homework from last year. How do I tar and zip the whole folder from command line Ubuntu (I don't have GUI).
Solution 1:
Use the following one-liner:
tar cf - <source folder> | 7z a -si <Destination archive>.tar.7z
Solution 2:
It is not a good idea compressing directly with 7z spcially on unix/linux systems: 7z does not preserve permissions and or user/group info. So: first tar, and then compress.
As reported on 7zip wiki page at http://en.wikipedia.org/wiki/7z#Limitations :
Limitations
The 7z format does not store filesystem permissions (such as UNIX owner/group permissions or NTFS ACLs), and hence can be inappropriate for backup/archival purposes. A workaround on UNIX-like systems for this is to convert data to a tar bitstream before compressing with 7z.