7zip is a compression/decompression utility program in Linux. With 7zip you can compress single files and folders recursively. This tutorial is about to create a 7z file from an entire folder recursively.
Let’s assume that you have a directory named myfolder and you want to compress it. In Linux terminal, type:
$ 7za a myfolder.7z myfolder/
That’s it. This creates a 7z file myfolder.7z in the same working directory. The argument
a stands for add and it also handles subdirectories, so each subfolder is included.
Note! also the
myfolder is included, not only its content, so when you decompress the 7z file, it will create a folder
myfolder in the current working directory. Read how to decompress the file: Extract .7z File in Linux.
To see contents of a .7z file, check this article: See List of Files in .7z File in Linux.