encrypt file with password
gpg -o <output-file> -c <file-to-encrypt>
the argument -o
takes the path to the output file (the encrypted one) and the flag -c
tells gpg
that we want to encrypt, you will be prompted to enter a password
decrypt file with password
gpg -o <output-file> -d <file-to-decrypt>
the argument -o
takes the path to the output file (the decrypted one) and the flag -d
tells gpg
that we want to decrypt
encrypt directory with password
to encrypt a directory, we simply compress it into a file:
tar -cvf archive.tar <directory>
for faster compression but bigger file size:
tar --use-compress-program="pigz -k -9 " -cf archive.tar <directory-to-compress>
and then encrypt that file