encrypt/decrypt file

To encrypt a file:

$ gpg -c filename

To decrypt a file:

$ gpg filename.gpg

encrypt/decrypt directory

To encrypt a directory:

$ gpg-zip -c -o dirname.gpg dirname

To decrypt a directory:

$ gpg-zip -d dirname.gpg

Possible errors

If you see this error below: {can’t connect to `/home/user/.gnupg/S.gpg-agent’: No such file or directory}

Then launch gpg agent daemon:

$ gpg-agent --daemon
GPG_AGENT_INFO=/tmp/gpg-Y1AjlZ/S.gpg-agent:2523:1; export GPG_AGENT_INFO;

then you’ll just have to create a symbolic link:

$ cp -fs /tmp/gpg-Y1AjlZ/S.gpg-agent ~/.gnupg/