PGP file decryption from Linux cmd line

How can I decrypt a .pgp file to .txt file using a key(.asc file) with the Linux command line.


Import your private key:

cat mykey.asc # should start with
-----BEGIN PGP PRIVATE KEY BLOCK-----
gpg --import mykey.asc

Check if it shows up:

gpg --list-secret-keys

Decrypt a message:

gpg --output ./decrypted_msg.txt --decrypt ./encrypted_msg.txt