crypt command can be used to encrypt/decrypt a particular text file in UNIX/LINUX. It is a simple encryption algorithm which works on a secret-key basis. It encrypts or decrypts a stream of data from standard input, and writes the result to standard output. Encryption and decryption is a symmetric process.
Encryption
This will create an encrypted file enTextFile.txt from a text file textFile.txt. You can use either of the commands both does one and the same task.
crypt ENCRYPTION_KEY < textFile.txt > enTextFile.txt
OR
cat textFile.txt | crypt > enTextFile.txt
Decryption
This will decrypt an encrypted file enTextFile.txt and store the output in textFile.txt
crypt ENCRYPTION_KEY < enTextFile.txt (to show data on console)
crypt ENCRYPTION_KEY < enTextFile.txt > textFile.txt
OR
cat enTextFile.txt | crypt > textFile.txt
Encryption
This will create an encrypted file enTextFile.txt from a text file textFile.txt. You can use either of the commands both does one and the same task.
crypt ENCRYPTION_KEY < textFile.txt > enTextFile.txt
OR
cat textFile.txt | crypt > enTextFile.txt
Decryption
This will decrypt an encrypted file enTextFile.txt and store the output in textFile.txt
crypt ENCRYPTION_KEY < enTextFile.txt (to show data on console)
crypt ENCRYPTION_KEY < enTextFile.txt > textFile.txt
OR
cat enTextFile.txt | crypt > textFile.txt