Tag: decrypt

  • Encrypt a file using gpg

    To encrypt a file using gpg command, run

    gpg -o myfile.tar.gpg --symmetric myfile.tar
    

    Now it will ask for a password. Once you enter password 2 times, file will be encrypted.

    Decrypt

    To decrypt a file, run

    gpg myfile.tar.gpg
    

    It will ask for the password, once you enter password, get file decrypted.

    Example

    gpg decrypt

    This encryption process will also compress the file.

    -rw-r--r--   1 root root 1559767040 Oct  1 08:35 home-boby.tar
    -rw-r--r--   1 root root  666947870 Oct  1 08:24 home-boby.tar.gpg
    

    In above example, 1.5 GB tar file get compressed into 600 MB file when encrypted with gpg