gpg --batch --output greetings.txt.gpg --passphrase mypassword --symmetric greetings.txt
gpg --batch --output greetings1.txt --passphrase mypassword --decrypt greetings.txt.gpg
Note that if we omit the --batch option, the system prompts us to enter the passphrase and then stores it in the session.
Therefore, to clear the password stored in the session, we can run:
echo RELOADAGENT | gpg-connect-agent