There are several ways to encrypt files on a UNIX-like system, such as Linux or BSD. Here are a few options:
gpg
command with the --encrypt
option. For example:gpg --encrypt --recipient example@example.com file.txt
This will encrypt the file file.txt
using the public key of the recipient (example@example.com). The encrypted file will have the extension .gpg
.
openssl
command with the enc
option. For example:openssl enc -aes-256-cbc -salt -in file.txt -out file.enc
This will encrypt the file file.txt
using the AES-256-CBC encryption algorithm and write the encrypted data to a new file called file.enc
.
tar
and gzip
commands together with the --gzip
and --encrypt
options. For example:tar -czvf - file.txt | gzip --encrypt --stdout > file.tgz
This will create an encrypted tar archive called file.tgz
containing the file file.txt
.