Difference between revisions of "Base64 (command)"

From wikieduonline
Jump to navigation Jump to search
 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[wikipedia:Base64]] [[binary-to-text encoding]]
+
{{lc}}[[wikipedia:Base64]] [[binary-to-text encoding]]
 
https://linux.die.net/man/1/base64
 
https://linux.die.net/man/1/base64
  
* <code>base64</code> command is included in <code>[[coreutils]]</code> package
+
* <code>base64</code> (<code>/usr/bin/base64</code>) command is included in <code>[[coreutils]]</code> package
* <code>[[openssl base64]]</code>
+
* Linux: <code>base64 inputfile.txt >> output.txt</code>
 
+
* Linux: <code>[[echo -n]] 'YOUR_TEST' | base64</code>
  [[openssl rand]] -[[base64]] 24
+
* macOS: <code>base64 --input inputfile.txt --output output.txt</code>
 
+
* <code>[[base64 --decode]]</code>
[[echo -n]] 'YOUR_TEST' | base64
+
* <code>base64 -w 0</code>
 
+
* <code>base64 -D / base64 -d / [[base64 --decode]]</code>
base64 -w 0
 
base64 -D / base64 -d / base64 --decode
 
  
 
<pre>echo  
 
<pre>echo  
Line 19: Line 17:
  
 
  base64 -d > certs/file[[.pfx]]
 
  base64 -d > certs/file[[.pfx]]
::<code>-d --decode</code>
+
::<code>-d --decode</code>
 +
 
 +
 
 +
base64
 +
(no output)
 +
[2]+  Stopped                base64
  
  base64 --help
+
== Help ==
 +
=== Mac ===
 +
  [[base64 --help]]
 
  Usage: base64 [-hvDd] [-b num] [-i in_file] [-o out_file]
 
  Usage: base64 [-hvDd] [-b num] [-i in_file] [-o out_file]
 
   -h, --help    display this message
 
   -h, --help    display this message
Line 28: Line 33:
 
   -i, --input    input file (default: "-" for stdin)
 
   -i, --input    input file (default: "-" for stdin)
 
   -o, --output  output file (default: "-" for stdout)
 
   -o, --output  output file (default: "-" for stdout)
 +
 +
=== Linux ===
 +
 +
base64 --help
 +
Usage: base64 [OPTION]... [FILE]
 +
Base64 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 base64 alphabet in RFC 4648.
 +
When decoding, the input may contain newlines in addition to the bytes of
 +
the formal base64 alphabet.  Use --ignore-garbage to attempt to recover
 +
from any other non-alphabet bytes in the encoded stream.
 +
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
 +
Report any translation bugs to <https://translationproject.org/team/>
 +
Full documentation <https://www.gnu.org/software/coreutils/base64>
 +
or available locally via: info '(coreutils) base64 invocation'
 +
 +
== Errors ==
 +
root@5# base64 --input yourfile.txt --output yourfile.txt
 +
base64: unrecognized option '--input'
 +
Try 'base64 --help' for more information.
  
 
== Related ==
 
== Related ==
 +
* <code>[[openssl base64]]</code>
 +
* <code>[[openssl rand]] -[[base64]] 24</code>
 
* [[SAML]]
 
* [[SAML]]
* <code>[[base64 --decode]]</code>
 
 
* <code>[[pbcopy]]</code>
 
* <code>[[pbcopy]]</code>
 
* <code>[[base64decode]]</code> [[Terraform function]]
 
* <code>[[base64decode]]</code> [[Terraform function]]
 +
* <code>[[kubectl describe secret]]</code>
 +
* [[Serialized]]
  
 
== See also ==
 
== See also ==
 
* <code>[[authorized_keys]]</code> file for <code>[[OpenSSH]]</code>
 
* <code>[[authorized_keys]]</code> file for <code>[[OpenSSH]]</code>
 
* {{base64}}
 
* {{base64}}
 +
* {{ASCII}}
  
 
[[Category:Linux commands]]
 
[[Category:Linux commands]]
 
[[Category:Encoding]]
 
[[Category:Encoding]]

Latest revision as of 15:08, 9 January 2024

wikipedia:Base64 binary-to-text encoding https://linux.die.net/man/1/base64

  • base64 (/usr/bin/base64) command is included in coreutils package
  • Linux: base64 inputfile.txt >> output.txt
  • Linux: echo -n 'YOUR_TEST' | base64
  • macOS: base64 --input inputfile.txt --output output.txt
  • base64 --decode
  • base64 -w 0
  • base64 -D / base64 -d / base64 --decode
echo 
'AAAAB3NzaC1yc2EAAAADAQABAAABAQDEbKq5U57fhzQ3SBbs3NVmgY2ouYZfPhc6cXBNEFpRT3T100fnbkYw+EHi76nwsp+uGxk08kh4GG881DrgotptrJj2dJxXpWp/SFdVu5S9fFU6l6dCTC9IBYYCCV8PvXbBZ3oDZyyyJT7/vXSaUdbk3x9MeNlYrgItm2KY6MdHYEg8R994Sspn1sE4Ydey5DfG/WNWVrzFCI0sWI3yj4zuCcUXFz9sEG8fIYikD9rNuohiMenWjkj6oLTwZGVW2q4wRL0051XBkmfnPD/H6gqOML9MbZQ8D6/+az0yF9oD61SkifhBNBRRNaIab/Np7XD61siR8zNMG/vCKjFGICnp' | base64 -D | md5
6530389635564f6464e8e3a47d593e19
kubectl get secret --namespace default grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
base64 -d > certs/file.pfx
::-d --decode


base64
(no output)
[2]+  Stopped                 base64

Help[edit]

Mac[edit]

base64 --help
Usage:	base64 [-hvDd] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -Dd, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)

Linux[edit]

base64 --help
Usage: base64 [OPTION]... [FILE]
Base64 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 base64 alphabet in RFC 4648.
When decoding, the input may contain newlines in addition to the bytes of
the formal base64 alphabet.  Use --ignore-garbage to attempt to recover
from any other non-alphabet bytes in the encoded stream.
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/base64>
or available locally via: info '(coreutils) base64 invocation'

Errors[edit]

root@5# base64 --input yourfile.txt --output yourfile.txt 
base64: unrecognized option '--input'
Try 'base64 --help' for more information.

Related[edit]

See also[edit]

Advertising: