ascii
Display ASCII character chart and information
TLDR
Show ASCII aliases of a character
Show ASCII aliases in short, script-friendly mode
Show ASCII aliases of multiple characters
Show ASCII table in decimal
Show ASCII table in hexadecimal
Show ASCII table in octal
Show ASCII table in binary
Show options summary and complete ASCII table
SYNOPSIS
ascii [-c|-x|-o|-d] [character|number...]
PARAMETERS
character|number...
One or more characters or numeric values (decimal, octal with '0' prefix, or hexadecimal with '0x' prefix) to convert and display their ASCII properties. If no arguments are given, ascii operates in an interactive mode, prompting for input.
-c
Classic mode. Displays only the character and its octal value, mimicking behavior of older versions or more terse output formats. This option typically overrides the default display of decimal, hexadecimal, and octal values.
-x
Explicitly requests display of hexadecimal values for the character(s). On many implementations, hexadecimal values are shown by default alongside decimal and octal, so this might be redundant or used to ensure specific output formats.
-o
Explicitly requests display of octal values for the character(s). Similar to -x, octal values are often part of the default output.
-d
Explicitly requests display of decimal values for the character(s). Similar to -x and -o, decimal values are often part of the default output.
DESCRIPTION
The ascii command is a utility designed to display the ASCII character set and provide detailed information about individual ASCII characters or their numeric representations. When invoked without arguments, it typically enters an interactive mode, prompting the user for input and displaying the decimal, octal, hexadecimal, and character forms of each entered character or string.
When command-line arguments are provided, ascii interprets them as characters or numeric values (decimal, octal prefixed with '0', or hexadecimal prefixed with '0x'). It then prints the corresponding ASCII information for each argument. This command is particularly useful for programmers, system administrators, or anyone needing quick lookups for character codes, especially when debugging character encoding issues or working with low-level data. It's a straightforward tool that helps in understanding the fundamental ASCII standard.
CAVEATS
The ascii command is not a standard core utility found on all Linux distributions by default. It is often provided as part of supplementary packages, such as the bsdgames collection. Consequently, its availability, specific options, and exact output format may vary slightly between different distributions and implementations.
It primarily deals with the 7-bit ASCII character set (0-127) and does not inherently handle multi-byte encodings like UTF-8. While it will process input bytes, it interprets them within the 7-bit ASCII context, potentially leading to misinterpretations for non-ASCII characters.
UNDERSTANDING ASCII
ASCII (American Standard Code for Information Interchange) is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes, like UTF-8, are based on ASCII. It defines 128 characters, with 95 printable characters (like 'A', 'B', 'C', etc., and symbols) and 33 non-printable control characters (like backspace, carriage return, line feed, etc.). The ascii command helps in visualizing these mappings.
HISTORY
The ascii command likely originated from BSD (Berkeley Software Distribution) systems as a simple, helpful utility for programmers and system administrators. It has maintained its straightforward functionality over the years, typically being bundled with other utility programs rather than undergoing significant independent development. Its primary purpose has remained consistent: providing quick access to ASCII character information.