命令行中输入 ASCII 字符
本文汇总了在所有 ASCII 字符及其在不同进制下的对应值,并给出了在命令行中输入对应字符的键盘输入,全文如下。
十进制 ASCII 码为 0 ~ 31 的字符为控制字符,ASCII 码为 32 ~ 127 的字符为可打印字符。在命令行中,控制字符按下表中的组合键输入,可打印字符直接按对应字符键输入(键略)。
十进制 | 二进制 | 十六进制 | 字符 | ASCII名称 | macOS 组合键 | Linux 组合键 |
---|---|---|---|---|---|---|
0 | 00000000 | 0x00 | ^@ | NUL | Ctrl-@ | Ctrl-@ |
1 | 00000001 | 0x01 | ^A | SOH | Ctrl-A | Ctrl-A |
2 | 00000010 | 0x02 | ^B | STX | Ctrl-B | Ctrl-B |
3 | 00000011 | 0x03 | ^C | ETX | Ctrl-V Ctrl-C | (未验证) |
4 | 00000100 | 0x04 | ^D | EOT | Ctrl-D | Ctrl-D |
5 | 00000101 | 0x05 | ^E | ENQ | Ctrl-E | Ctrl-E |
6 | 00000110 | 0x06 | ^F | ACK | Ctrl-F | Ctrl-F |
7 | 00000111 | 0x07 | ^G | BEL | Ctrl-G | Ctrl-G |
8 | 00001000 | 0x08 | ^H | BS | Ctrl-H | Ctrl-H |
9 | 00001001 | 0x09 | Tab, ^I | HT | Tab, Ctrl-I | Tab, Ctrl-I |
10 | 00001010 | 0x0A | ^J | LF | Ctrl-J | Ctrl-J |
11 | 00001011 | 0x0B | ^K | VT | Ctrl-K | Ctrl-K |
12 | 00001100 | 0x0C | ^L | FF | Ctrl-L | Ctrl-L |
13 | 00001101 | 0x0D | ^M | CR | Ctrl-V Ctrl-M | (未验证) |
14 | 00001110 | 0x0E | ^N | SO | Ctrl-N | Ctrl-N |
15 | 00001111 | 0x0F | ^O | SI | Ctrl-V Ctrl-O | Ctrl-O |
16 | 00010000 | 0x10 | ^P | DLE | Ctrl-P | Ctrl-P |
17 | 00010001 | 0x11 | ^Q | DC1 | Ctrl-V Ctrl-Q | (未验证) |
18 | 00010010 | 0x12 | ^R | DC2 | Ctrl-R | Ctrl-R |
19 | 00010011 | 0x13 | ^S | DC3 | Ctrl-V Ctrl-S | (未验证) |
20 | 00010100 | 0x14 | ^T | DC4 | Ctrl-T | Ctrl-T |
21 | 00010101 | 0x15 | ^U | NAK | Ctrl-U | Ctrl-U |
22 | 00010110 | 0x16 | ^V | SYN | Ctrl-V Ctrl-V | Ctrl-V |
23 | 00010111 | 0x17 | ^W | ETB | Ctrl-W | Ctrl-W |
24 | 00011000 | 0x18 | ^X | CAN | Ctrl-X | Ctrl-X |
25 | 00011001 | 0x19 | ^Y | EM | Ctrl-V Ctrl-Y | Ctrl-Y |
26 | 00011010 | 0x1A | ^Z | SUB | Ctrl-V Ctrl-Z | (未验证) |
27 | 00011011 | 0x1B | Esc, ^[ | ESC | Ctrl-[ | Esc, Ctrl-[ |
28 | 00011100 | 0x1C | ^\ | FS | Ctrl-V Ctrl-\ | (未验证) |
29 | 00011101 | 0x1D | ^] | GS | Ctrl-] | Ctrl-] |
30 | 00011110 | 0x1E | ^^ | RS | Ctrl-^ | Ctrl-^ |
31 | 00011111 | 0x1F | ^- | US | Ctrl-- | Ctrl-- |
32 | 00100000 | 0x20 | (Space) | SP | ||
33 | 00100001 | 0x21 | ! | |||
34 | 00100010 | 0x22 | " | |||
35 | 00100011 | 0x23 | # | |||
36 | 00100100 | 0x24 | $ | |||
37 | 00100101 | 0x25 | % | |||
38 | 00100110 | 0x26 | & | |||
39 | 00100111 | 0x27 | ' | |||
40 | 00101000 | 0x28 | ( | |||
41 | 00101001 | 0x29 | ) | |||
42 | 00101010 | 0x2A | * | |||
43 | 00101011 | 0x2B | + | |||
44 | 00101100 | 0x2C | , | |||
45 | 00101101 | 0x2D | - | |||
46 | 00101110 | 0x2E | . | |||
47 | 00101111 | 0x2F | / | |||
48 | 00110000 | 0x30 | 0 | |||
49 | 00110001 | 0x31 | 1 | |||
50 | 00110010 | 0x32 | 2 | |||
51 | 00110011 | 0x33 | 3 | |||
52 | 00110100 | 0x34 | 4 | |||
53 | 00110101 | 0x35 | 5 | |||
54 | 00110110 | 0x36 | 6 | |||
55 | 00110111 | 0x37 | 7 | |||
56 | 00111000 | 0x38 | 8 | |||
57 | 00111001 | 0x39 | 9 | |||
58 | 00111010 | 0x3A | : | |||
59 | 00111011 | 0x3B | ; | |||
60 | 00111100 | 0x3C | < | |||
61 | 00111101 | 0x3D | = | |||
62 | 00111110 | 0x3E | > | |||
63 | 00111111 | 0x3F | ? | |||
64 | 01000000 | 0x40 | @ | |||
65 | 01000001 | 0x41 | A | |||
66 | 01000010 | 0x42 | B | |||
67 | 01000011 | 0x43 | C | |||
68 | 01000100 | 0x44 | D | |||
69 | 01000101 | 0x45 | E | |||
70 | 01000110 | 0x46 | F | |||
71 | 01000111 | 0x47 | G | |||
72 | 01001000 | 0x48 | H | |||
73 | 01001001 | 0x49 | I | |||
74 | 01001010 | 0x4A | J | |||
75 | 01001011 | 0x4B | K | |||
76 | 01001100 | 0x4C | L | |||
77 | 01001101 | 0x4D | M | |||
78 | 01001110 | 0x4E | N | |||
79 | 01001111 | 0x4F | O | |||
80 | 01010000 | 0x50 | P | |||
81 | 01010001 | 0x51 | Q | |||
82 | 01010010 | 0x52 | R | |||
83 | 01010011 | 0x53 | S | |||
84 | 01010100 | 0x54 | T | |||
85 | 01010101 | 0x55 | U | |||
86 | 01010110 | 0x56 | V | |||
87 | 01010111 | 0x57 | W | |||
88 | 01011000 | 0x58 | X | |||
89 | 01011001 | 0x59 | Y | |||
90 | 01011010 | 0x5A | Z | |||
91 | 01011011 | 0x5B | [ | |||
92 | 01011100 | 0x5C | \ | |||
93 | 01011101 | 0x5D | ] | |||
94 | 01011110 | 0x5E | ^ | |||
95 | 01011111 | 0x5F | _ | |||
96 | 01100000 | 0x60 | ` | |||
97 | 01100001 | 0x61 | a | |||
98 | 01100010 | 0x62 | b | |||
99 | 01100011 | 0x63 | c | |||
100 | 01100100 | 0x64 | d | |||
101 | 01100101 | 0x65 | e | |||
102 | 01100110 | 0x66 | f | |||
103 | 01100111 | 0x67 | g | |||
104 | 01101000 | 0x68 | h | |||
105 | 01101001 | 0x69 | i | |||
106 | 01101010 | 0x6A | j | |||
107 | 01101011 | 0x6B | k | |||
108 | 01101100 | 0x6C | l | |||
109 | 01101101 | 0x6D | m | |||
110 | 01101110 | 0x6E | n | |||
111 | 01101111 | 0x6F | o | |||
112 | 01110000 | 0x70 | p | |||
113 | 01110001 | 0x71 | q | |||
114 | 01110010 | 0x72 | r | |||
115 | 01110011 | 0x73 | s | |||
116 | 01110100 | 0x74 | t | |||
117 | 01110101 | 0x75 | u | |||
118 | 01110110 | 0x76 | v | |||
119 | 01110111 | 0x77 | w | |||
120 | 01111000 | 0x78 | x | |||
121 | 01111001 | 0x79 | y | |||
122 | 01111010 | 0x7A | z | |||
123 | 01111011 | 0x7B | { | |||
124 | 01111100 | 0x7C | | | |||
125 | 01111101 | 0x7D | } | |||
126 | 01111110 | 0x7E | ~ | |||
127 | 01111111 | 0x7F | Del |
笔者分别在实验环境一、二的原生终端内,用 87 键键盘输入 ASCII 字符进行了验证。
在 Raspbian Stretch 上的测试中存在”(未验证)“的 ASCII 字符,是因为该示例代码无法通过键盘输入对应的控制符。
受限于作者的水平,读者如发现有任何错误或有疑问之处,请追加评论或发邮件联系 green-pi@qq.com。作者将在收到意见后的第一时间里予以回复。 本文来自博客园,作者:green-cnblogs,转载请注明原文链接:https://www.cnblogs.com/green-cnblogs/p/17174327.html 谢谢!