Abbreviated flags:
-a
is--armor
for ascii armored output (allows output to be sent via the web, etc.)-r
is--recipient
for specifying the recipient of the message (needs to use the name of an imported key)
This can be used for encrypting messages so only the person with the private key can read them
gpg --import ./path/to/public.key
You'll need to know the name of the key you want to use
gpg --list-keys
This uses the name of the public key that was imported to encrypt the message
gpg --output ./path/to/encrypted.txt --encrypt -a -r NAME_OF_KEY ./path/to/input.txt
To decrypt an encrypted message you will need to have the private key associated with the public key that the message was signed with
gpg --output ./path/to/output.txt --decrypt ./path/to/encrypted.txt
If you give this to people then they can encrypt messages that only you can read with your private key
WARNING: Never share your private key
gpg --output ./path/to/public.key --export -a NAME_OF_KEY