#Bash 的 base64 命令
1base64 [OPTION]... [FILE]... 2
功能
进行 BASE64 编码或解码。
类型
可执行文件(/usr/bin/base64),属于 coreutils。
参数
OPTION选项:-d,--decode- 解码;不带此选项则为编码-i,--ignore-garbage- 解码时忽略无效字符-w,--wrap=COLS- 编码输出时一行的字符数;默认为 76,设为 0 则不换行--help- 显示帮助--version- 显示版本
FILE- 文件列表
#示例
1$ man base64 > 1.txt 2$ cat 1.txt 3BASE64(1) User Commands BASE64(1) 4 5NAME 6 base64 - base64 encode/decode data and print to standard output 7 8SYNOPSIS 9 base64 [OPTION]... [FILE] 10... 11$ base64 1.txt > 2.txt # 编码 12$ cat 2.txt 13QkFTRTY0KDEpICAgICAgICAgICAgICAgICAgICAgICAgVXNlciBDb21tYW5kcyAgICAgICAgICAg 14ICAgICAgICAgICAgQkFTRTY0KDEpCgpOQU1FCiAgICAgICBiYXNlNjQgLSBiYXNlNjQgZW5jb2Rl 15L2RlY29kZSBkYXRhIGFuZCBwcmludCB0byBzdGFuZGFyZCBvdXRwdXQKClNZTk9QU0lTCiAgICAg 16ICBiYXNlNjQgW09QVElPTl0uLi4gW0ZJTEVdCgpERVNDUklQVElPTgogICAgICAgQmFzZTY0IGVu 17... 18$ base64 -d 2.txt # 解码 19BASE64(1) User Commands BASE64(1) 20 21NAME 22 base64 - base64 encode/decode data and print to standard output 23 24SYNOPSIS 25 base64 [OPTION]... [FILE] 26... 27
#相关命令
| 命令 | 说明 |
|---|---|
| base32 | 进行 BASE32 编码或解码 |
| basenc | 进行 BASE2 BASE16 BASE32 BASE64 编码或解码 |
#推荐阅读
#手册
显示
1BASE64(1) User Commands BASE64(1) 2 3NAME 4 base64 - base64 encode/decode data and print to standard output 5 6SYNOPSIS 7 base64 [OPTION]... [FILE] 8 9DESCRIPTION 10 Base64 encode or decode FILE, or standard input, to standard output. 11 12 With no FILE, or when FILE is -, read standard input. 13 14 Mandatory arguments to long options are mandatory for short options 15 too. 16 17 -d, --decode 18 decode data 19 20 -i, --ignore-garbage 21 when decoding, ignore non-alphabet characters 22 23 -w, --wrap=COLS 24 wrap encoded lines after COLS character (default 76). Use 0 to 25 disable line wrapping 26 27 --help display this help and exit 28 29 --version 30 output version information and exit 31 32 The data are encoded as described for the base64 alphabet in RFC 4648. 33 When decoding, the input may contain newlines in addition to the bytes 34 of the formal base64 alphabet. Use --ignore-garbage to attempt to re‐ 35 cover from any other non-alphabet bytes in the encoded stream. 36 37AUTHOR 38 Written by Simon Josefsson. 39 40REPORTING BUGS 41 GNU coreutils online help: <https://www.gnu.org/software/coreutils/> 42 Report any translation bugs to <https://translationproject.org/team/> 43 44COPYRIGHT 45 Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU 46 GPL version 3 or later <https://gnu.org/licenses/gpl.html>. 47 This is free software: you are free to change and redistribute it. 48 There is NO WARRANTY, to the extent permitted by law. 49 50SEE ALSO 51 basenc(1) 52 53 Full documentation <https://www.gnu.org/software/coreutils/base64> 54 or available locally via: info '(coreutils) base64 invocation' 55 56GNU coreutils 9.4 April 2024 BASE64(1) 57
《Bash 的 base64 命令》 是转载文章,点击查看原文。