Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.
I usually encrypt files with GPG with symmetric algorithms when I have to transmit files over insecure channel: for example I encrypt backup files stored at my USB stick and I'm sure that if it’s stolen or lost my files are in safety.
Encryption without user intervention can be used when you wish to perform automatic (runs with cron) backup procedure and protect backup files.
To encrypt file /tmp/file.tgz by symmetric AES algorithm (256 is a key lenght) with one command please use the following command:
echo password | gpg --batch -q --passphrase-fd 0 --cipher-algo AES256 -c /tmp/file.tgz
Previous command will create file.tgz.gpg that can be extracted automatically by next one:
Share Thisecho password | gpg --batch -q -o /tmp/file.tgz --passphrase-fd 0 --decrypt /tmp/file.tgz.gpg

Thank you, just what I was looking for!