Tips to use GPG to encrypt file

These are some tips to encrypt a file with the Key ID from a :

Search the user Key ID:

$ gpg --keyserver --search-keys

Let us to suppose the user Key ID is ABCDEF12 then you receive it:

$ gpg --keyserver --recv-keys ABCDEF12

or if you have the public key of destination user:

$ gpg --import userkey.asc

Finally you encrypt the file this way:

$ gpg --output fileencrypted.gpg --encrypt --recipient fileplain.txt