Ubuntu – Archiving a directory and Encrypting the File using 7zip and OpenSSL

First archive the directory using 7zip.

7z a filename.7z targetdirectory

Next, encrypt the file using OpenSSL. Executing the command will ask the user for a password

openssl aes-256-cbc -in filename.7z -out file.enc

You can decrypt the file using the following command. Executing the command will ask the user for a password.

openssl aes-256-cbc -d -in file.enc -out filename.7z

 Reference