base32

Linux base32 command is encode or decode the string or file. Below description with examples will explain on how to use this command.  

DEFINITION
base32 encode/decode data and print to standard output
USAGE
base32 [OPTION]... [FILE]
DESCRIPTION
Base32 encode or decode FILE, or standard input, to standard output.

       With no FILE, or when FILE is -, read standard input.

       Mandatory arguments to long options are mandatory for short options too.

       -d, --decode
              decode data

       -i, --ignore-garbage
              when decoding, ignore non-alphabet characters

       -w, --wrap=COLS
              wrap encoded lines after COLS character (default 76).  Use 0 to disable line wrapping

       --help display this help and exit

       --version
              output version information and exit

       The  data  are encoded as described for the base32 alphabet in RFC 4648.  When decoding, the input may
       contain newlines in addition to the bytes of the formal base32 alphabet.  Use --ignore-garbage to  at‐
       tempt to recover from any other non-alphabet bytes in the encoded stream.
EXAMPLES
#below command can be used to encode a string using echo
   root@letusstudy:/var/log# echo "hello" | base32
   NBSWY3DPBI======

#below command can be used to decode a string
   root@letusstudy:/var/log# echo NBSWY3DPBI====== | base32 --decode
   hello

#below command can be used to encode a string using printf
   root@letusstudy:/var/log# printf "hello" | base32
   NBSWY3DP

#below command can be used to decode a string using printf
   root@letusstudy:/var/log# printf  NBSWY3DPBI====== | base32 --decode
   hello

You can also apply the base32 command to encode or decode a file. 

#In this example, we will decode dpkg.log file
root@letusstudy:/var/log# head dpkg.log 
2020-07-31 16:27:13 startup archives install
2020-07-31 16:27:13 install base-passwd:amd64 <none> 3.5.47
2020-07-31 16:27:13 status half-installed base-passwd:amd64 3.5.47
2020-07-31 16:27:13 status unpacked base-passwd:amd64 3.5.47
2020-07-31 16:27:13 configure base-passwd:amd64 3.5.47 3.5.47
2020-07-31 16:27:13 status half-configured base-passwd:amd64 3.5.47
2020-07-31 16:27:13 status installed base-passwd:amd64 3.5.47
2020-07-31 16:27:14 startup archives install
2020-07-31 16:27:14 install base-files:amd64 <none> 11ubuntu5
2020-07-31 16:27:14 status half-installed base-files:amd64 11ubuntu5

#Below command will encode dpkg.log to dpkg_encode.log
root@letusstudy:/var/log# base32 dpkg.log > dpkg_encode.log 

#Encoded file
root@letusstudy:/var/log# head dpkg_encode.log 
GIYDEMBNGA3S2MZREAYTMORSG45DCMZAON2GC4TUOVYCAYLSMNUGS5TFOMQGS3TTORQWY3AKGIYD
EMBNGA3S2MZREAYTMORSG45DCMZANFXHG5DBNRWCAYTBONSS24DBONZXOZB2MFWWINRUEA6G433O
MU7CAMZOGUXDINYKGIYDEMBNGA3S2MZREAYTMORSG45DCMZAON2GC5DVOMQGQYLMMYWWS3TTORQW
Y3DFMQQGEYLTMUWXAYLTON3WIOTBNVSDMNBAGMXDKLRUG4FDEMBSGAWTANZNGMYSAMJWHIZDOORR
GMQHG5DBOR2XGIDVNZYGCY3LMVSCAYTBONSS24DBONZXOZB2MFWWINRUEAZS4NJOGQ3QUMRQGIYC
2MBXFUZTCIBRGY5DENZ2GEZSAY3PNZTGSZ3VOJSSAYTBONSS24DBONZXOZB2MFWWINRUEAZS4NJO
GQ3SAMZOGUXDINYKGIYDEMBNGA3S2MZREAYTMORSG45DCMZAON2GC5DVOMQGQYLMMYWWG33OMZUW
O5LSMVSCAYTBONSS24DBONZXOZB2MFWWINRUEAZS4NJOGQ3QUMRQGIYC2MBXFUZTCIBRGY5DENZ2
GEZSA43UMF2HK4ZANFXHG5DBNRWGKZBAMJQXGZJNOBQXG43XMQ5GC3LEGY2CAMZOGUXDINYKGIYD
EMBNGA3S2MZREAYTMORSG45DCNBAON2GC4TUOVYCAYLSMNUGS5TFOMQGS3TTORQWY3AKGIYDEMBN
root@letusstudy:/var/log# 

AUTHOR
Written by Simon Josefsson.

REPORTING BUGS
GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report base32 translation bugs to <https://translationproject.org/team/>

Search Results