p7zip is the Unix command-line port of 7-Zip, a file archiver that handles the 7z format which features very high compression ratios.
– /usr/bin/7zr – a standalone minimal version of the 7-zip tool that only handles 7z, LZMA and XZ archives. 7z compression is 30-50% better than ZIP compression.
– /usr/bin/p7zip – a gzip-like wrapper around 7zr.
p7zip can be used with popular compression interfaces (such as File Roller or Nautilus).
p7zip-full, provides 7z and 7za which support more compression formats.
sudo apt-get install p7zip-full
7z Compress file
7z a myfile.7z myfile.pdf
7z Compress folder
7z a -r myfile.7z folder_name/
7z Compress file – Password protected
7z a -p myfile.7z myfile.pdf
7z Compress folder – Password protected
7z a -p -r myfile.7z folder_name/
7z Extract archive contents
7z x myfile.7z
7z List archive contents
7z l myfile.7z