--- title: encryption - How to encrypt a file or directory in Linux? date: 2015-10-03T14:06:45Z source: http://superuser.com/questions/249497/how-to-encrypt-a-file-or-directory-in-linux tags: security --- I think it would be gpg. The syntax for files and directories differs though. ## Encryption For files(outputs filename.gpg): gpg -c filename For dirs: gpg-zip -c -o file.gpg dirname ## Decryption For files(outputs filename.gpg): gpg filename.gpg For dirs: gpg-zip -d file.gpg Edit: Corrected as @Mk12 pointed out the mistake of compression/decompression for encryption/decryption.