Any time you have a text file on a Linux system that you want to keep private regardless of the privileges that other users with accounts on the system may have, you can resort to encryption. One easy way to do this is to use a feature that is built into the vim editor. You will have to provide a password that will you then need to remember or store in a password safe, but the process is straightforward. The file name will not be changed in any way, and the content of the file can be recovered in much the same way that it was encrypted.
To begin, let’s say that we have a file that begins like this:
$ head -3 mysecret
I feel the need to put my deepest darkest secret into a text file on my Linux
system. While this likely isn’t common practice, I’m not sure that I can trust
anyone with it. But a penguin? That’s a different story! So here goes …
Now, not wanting to risk your deepest darkest secret to fellow users, you use vim with its -x (encryption) option.
Source:: Network World – Linux