Simple file Encryption and Decryption using encryption key

Transfered from Linux Config Disqus comments:
Question:

Is there a easy way to encrypt and decrypt a file on a Ubuntu Linux system?
Answer:
If you are looking for a simple way to encrypt and decrypt files your should consider to use ccrypt. Use a following command to install ccrypt on a Ubuntu Linux system:


# apt-get install ccrypt

When ready you can use ccrypt to encrypt any file. Example:

$ ccrypt to-encrypt.txt 
Enter encryption key: 
Enter encryption key: (repeat) 
$ ls to-encrypt.txt.cpt 
to-encrypt.txt.cpt

In the above example we have encrypted a file to-encrypt.txt. Output of this operation is file to-encrypt.txt.cpt. To decrypt this file we need to use ccdecrypt and encryption key we used to encrypt it:

$ ccdecrypt to-encrypt.txt.cpt
Enter decryption key: