To encrypt file.txt (you will be prompted for a password):

openssl aes-256-cbc -salt -in file.txt -out file.txt.enc

To decrypt file.txt.enc (you will be prompted for the password used to encrypt):

openssl aes-256-cbc -d -in file.txt.enc -out file.txt

via: Tombuntu