DEV Community

Cover image for Living in the Shell #1; base64
Babak K. Shandiz
Babak K. Shandiz

Posted on • Originally published at babakks.github.io on

Living in the Shell #1; base64

Encode inline

echo -n 'Hello World!' | base64
Enter fullscreen mode Exit fullscreen mode

Encode file (into file)

base64 ~/.bashrc > encoded-file.txt
Enter fullscreen mode Exit fullscreen mode
cat ~/.bashrc | base64 > encoded-file.txt
Enter fullscreen mode Exit fullscreen mode

Decode inline

echo -n "SGVsbG8gV29ybGQh" | base64 -d
Enter fullscreen mode Exit fullscreen mode

Decode file (into file)

base64 -d encoded-file.txt > decoded-file.txt
Enter fullscreen mode Exit fullscreen mode
cat encoded-file.txt | base64 -d > decoded-file.txt
Enter fullscreen mode Exit fullscreen mode

Top comments (0)