Base64 encoding and decoding
Posted: 2023 May 03, 19:04
We have the file test.txt with the following content
Encode the file
The content for the new file changed
To decode the file to its original form, execute the command
For the encoding[1] and decoding[2] of an archive type file we have the following example
Code: Select all
$ cat test.txt
123
321
Code: Select all
$ base64 test.txt > test.txt.base64
$ cat test.txt.base64
MTIzCjMyMQo=
To decode the file to its original form, execute the command
Code: Select all
$ base64 -d test.txt.base64
123
321
Code: Select all
[1]$ tar czvf - folder | base64 > folder.tar.tgz.b64
[2]$ base64 -d folder.tar.tgz.b64 | tar xzvf -