Gnugpg is in many ways the champion of encryption on Linux(personal opinion).
Sometimes there is a need to do quick password based encryption. This can be achieved with ccrypt.
Ccrypt should be available on standard Debian/Ubuntu or Centos8 repository resources.
I use Debian base here, but the steps should be similar on Centos8 or equivalent.
sudo apt-get install ccrypt -y
echo “I am going to be encrypted” >> ./example.txt
ccrypt ./example.txt
At this point a password for the encryption is needed. For this example, I used: hello.
After the encryption, my file will be found as: example.txt.cpt.
If I now try to read this cpt file, there will be nothing that can be understood on the output.
To decrypt and make the file readable again: ccdecrypt ./example.txt.cpt
After decryption, the example.txt is again found as a clear text file.