Friday, July 8, 2016

How to Base64 Encode/Decode in Ubuntu command line

There are many situations where we need to get a Base64 Encoded string or a decode an already encoded string.

We can use the Linux command line to achieve this easily.

Encode a String: 


To Encode the string "admin:admin" we can use the following command.
echo -n 'admin:admin' | base64
This would give a result similar to the following.
YWRtaW46YWRtaW4= 


Decode a String:


To Decode the string "YWRtaW46YWRtaW4=" we can use the following command.
echo "YWRtaW46YWRtaW4=" | base64 --decode
This would give a result similar to the following
admin:admin 

No comments:

Post a Comment