Donation?

Harley Hahn
Home Page

Send a Message
to Harley


A Personal Note
from Harley Hahn

Unix Book
Home Page

SEARCH

List of Chapters

Table of Contents

List of Figures

Chapters...
   1   2   3
   4   5   6
   7   8   9
  10  11  12
  13  14  15
  16  17  18
  19  20  21
  22  23  24
  25  26

Glossary

Appendixes...
  A  B  C
  D  E  F
  G  H

Command
Summary...

• Alphabetical
• By category

Unix-Linux
Timeline

Internet
Resources

Errors and
Corrections

Endorsements


INSTRUCTOR
AND STUDENT
MATERIAL...

Home Page
& Overview

Exercises
& Answers

The Unix Model
Curriculum &
Course Outlines

PowerPoint Files
for Teachers

Appendix D...

The ASCII Code

Before the 1990s, the character encoding used by Unix (and most computer systems) was the ASCII CODE, often referred to as ASCII. The name stands for "American Standard Code for Information Interchange".

The ASCII code was created in 1967. It specifies a 7-bit pattern for every character, 128 in all. These bit patterns range from 0000000 (0 in decimal) to 1111111 (127 in decimal). For this reason, the 128 ASCII characters are numbered from 0 to 127.

The 128 characters that comprise the ASCII code consist of 33 "control characters" and 95 "printable characters". The control characters are discussed in see Chapter 7. The printable characters, shown below, are the 52 letters of the alphabet (26 uppercase, 26 lowercase), 10 numbers, 32 punctuation symbols, and the space character (listed first below):

 !"#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ 'abcdefghijklmnopqrstuvwxyz{|}~

As a convenience, most Unix systems have a reference page showing the ASCII code to allow you to look at it quickly whenever you want. Unfortunately, the ASCII reference page is not standardized, so the way in which you display it depends on which system you are using. You can see the details in Figure 19-1 or Figure 20-5.

For reference, the tables below contain the 128 characters of the ASCII code along with their decimal (base 10), hexadecimal (base 16), octal (base 8), and binary (base 2) equivalents. For a discussion of the binary, octal, and hexadecimal number systems see Chapter 21.

Character Decimal Hex Octal Binary  
   0000000000 0000 (null)
Ctrl-A 1010010000 0001 
Ctrl-B 2020020000 0010 
Ctrl-C 3030030000 0011 
Ctrl-D 4040040000 0100 
Ctrl-E 5050050000 0101 
Ctrl-F 6060060000 0110 
Ctrl-G 7070070000 0111 (beep)
Ctrl-H 8080100000 1000  backspace
Ctrl-I 9090110000 1001  tab
Ctrl-J 100A0120000 1010 
Ctrl-K 110B0130000 1011 
Ctrl-L 120C0140000 1100 
Ctrl-M 130D0150000 1101  return
Ctrl-N 140E0160000 1110 
Ctrl-O 150F0170000 1111 
Ctrl-P 16100200001 0000 
Ctrl-Q 17110210001 0001 
Ctrl-R 18120220001 0010 
Ctrl-S 19130230001 0011 
Ctrl-T 10140240001 0100 
Ctrl-U 21150250001 0101 
Ctrl-V 22160260001 0110 
Ctrl-W 23170270001 0111 
Ctrl-X 24180200001 1000 
Ctrl-Y 25190210001 1001 
Ctrl-Z 261A0220001 1010 
Ctrl-[ 271B0230001 1011  escape
Ctrl-\ 281C0240001 1100 
Ctrl-] 291D0250001 1101 
Ctrl-^ 301E0260001 1110 
Ctrl-_ 311F0270001 1111 

Jump to top of page

Character Decimal Hex Octal Binary  
(space) 32200400010 0000  space
! 33210410010 0001 (exclamation mark)
" 34220420010 0010 (double quote)
# 35230430010 0011 (number sign)
$ 36240440010 0100 (dollar sign)
% 37250450010 0101 (percent)
&38260460010 0110 (ampersand)
' 39270470010 0111 (single quote)
( 40280500010 1000 (left parenthesis)
) 41290510010 1001 (right parenthesis)
* 422A0520010 1010 (asterisk)
+ 432B0530010 1011 (plus)
, 442C0540010 1100 (comma)
- 452D0550010 1101 (minus/hyphen)
. 462E0560010 1110 (period)
/ 472F0570010 1111 (slash)
0 48300600011 0000 
1 49310610011 0001 
2 50320620011 0010 
3 51330630011 0011 
4 52340640011 0100 
5 53350650011 0101 
6 54360660011 0110 
7 55370670011 0111 
8 56380700011 1000 
9 57390710011 1001 
: 583A0720011 1010(colon)
; 593B0730011 1011(semicolon)
< 603C0740011 1100(less than)
= 613D0750011 1101(equals)
> 623E0760011 1110(greater than)
? 633F0770011 1111(question mark)

Jump to top of page

Character Decimal Hex Octal Binary  
@64401000100 0000 (at sign)
A65411010100 0001 
B66421020100 0010 
C67431030100 0011 
D68441040100 0100 
E69451050100 0101 
F70461060100 0110 
G71471070100 0111 
H72481100100 1000 
I73491110100 1001 
J744A1120100 1010 
K754B1130100 1011 
L764C1140100 1100 
M774D1150100 1101 
N784E1160100 1110 
O794F1170100 1111 
P80501200101 0000 
Q81511210101 0001 
R82521220101 0010 
S83531230101 0011 
T84541240101 0100 
U85551250101 0101 
V86561260101 0110 
W87571270101 0111 
X88581300101 1000 
Y89591310101 1001 
Z905A1320101 1010 (left square bracket)
[915B1330101 1011 (backslash)
\925C1340101 1100 (right square bracket)
]935D1350101 1101 (circumflex)
^945E1360101 1110 (underscore)
_955F1370101 1111 

Jump to top of page

Character Decimal Hex Octal Binary  
` 96601400110 0000 (back quote)
a 97611410110 0001 
b 98621420110 0010 
c 99631430110 0011 
d 100641440110 0100 
e 101651450110 0101 
f 102661460110 0110 
g 103671470110 0111 
h 104681500110 1000 
i 105691510110 1001 
j 1066A1520110 1010 
k 1076B1530110 1011 
l 1086C1540110 1100 
m 1096D1550110 1101 
n 1106E1560110 1110 
o 1116F1570110 1111 
p 112701600111 0000 
q 113711610111 0001 
r 114721620111 0010 
s 115731630111 0011 
t 116741640111 0100 
u 117751650111 0101 
v 118761660111 0110 
w 119771670111 0111 
x 120781700111 1000 
y 121791710111 1001 
z 1227A1720111 1010 
{ 1237B1730111 1011 (left brace bracket)
| 1247C1740111 1100 (vertical bar)
} 1257D1750111 1101 (right brace bracket)
~ 1267E1760111 1110 (tilde)
1277F1770111 1111  del

Jump to top of page