Amazon Cyber Monday deals See deals →ad

Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

ASCII Art in the Linux Terminal: How to Make It

ASCII art in a Linux terminal is text arranged to form pictures, lettering, or decorative patterns. You can display it with ordinary shell commands, save it in a text file, or generate it with tools such as FIGlet; no special terminal feature is required.

What ASCII art means in a terminal

ASCII is a character-encoding standard whose original character set contains 128 characters, including English letters, digits, punctuation, and control codes. ASCII art uses printable characters from that set—such as slashes, brackets, underscores, and periods—to suggest shapes. A simple example is a smiling face, :-), while a larger drawing might use rows of characters to outline a cat or a landscape.

People often use “ASCII art” loosely to mean any picture made from text. Strictly speaking, artwork that includes characters outside the original ASCII set is not ASCII-only. Box-drawing characters, accented letters, and many symbols belong to other character sets or Unicode. That distinction matters in terminals because a Unicode drawing may look fine on one system but appear as missing-character boxes on another.

In Linux, the terminal emulator displays characters produced by a shell or a program. The shell does not interpret a picture as an image: it passes text to the terminal, which draws each character in a cell. This makes text art easy to copy, store, and include in scripts, but its appearance depends on the font, terminal width, and character encoding.

Display a drawing with basic shell commands

The simplest way to show ASCII art is to put it in a text file and print the file. For example, create picture.txt in a text editor, enter several lines of art, save it, and run cat picture.txt. This is a good choice for fixed artwork because the exact spacing is visible and easy to adjust.

You can also use a quoted here-document to write a small drawing directly from the shell:

cat <<'EOF'
 /\_/\\
( o.o )
 > ^ <
EOF

The quoted marker, 'EOF', tells the shell not to expand variables or interpret substitutions inside the block. That is useful when the art includes dollar signs, backticks, or backslashes. The sample is only an illustration: backslashes are easy to miscount, so check the output and adjust the lines for the shape you want.

For a single line, use printf, for example printf ' /\_/\\\n( o.o )\n'. Unlike echo, whose handling of options and backslash escapes can vary, printf has predictable formatting rules. For multi-line art, though, a file or here-document is usually easier to read and maintain.

Generate large lettering with FIGlet and Toilet

If you want a word rendered in oversized terminal letters, a text-art generator is more convenient than drawing each character by hand. FIGlet is a widely used program that turns input text into blocky or stylized lettering. On Debian or Ubuntu, it is commonly installed with sudo apt install figlet; package names and availability can differ on other distributions.

After installation, try figlet Hello. The program prints several lines of text art. You can ask it to use a font with figlet -f small Hello, if that font is installed. Run figlet -h or consult its manual page with man figlet to see options supported by your installed version. Some fonts are wide, so a long heading can wrap or be clipped in a narrow terminal.

Toilet is another text-to-banner program, with options for fonts and effects. A typical example is toilet -f future Hello, provided that the selected font is available. It may also support color or other formatting options depending on the build. FIGlet and Toilet are useful for headings, shell prompts, and playful messages; they are not substitutes for an image editor when you need detailed pictures or precise visual layout.

Try cowsay and other terminal-art tools

cowsay places a speech bubble beside a small character drawing. For example, cowsay 'Hello from Linux' prints a cow-like figure with the message in a bubble. It is often used for jokes or demonstrations rather than for creating general-purpose ASCII pictures. Some installations also provide related commands or alternative character files.

These tools can be combined with shell pipelines. For instance, figlet Welcome | cowsay sends the banner output to cowsay as its message. The result may be very wide, so a short word and a large terminal window work better. A pipeline passes text between programs; it does not guarantee that the second program will preserve the first program’s layout exactly.

Other options include online text-art generators, text editors with fixed-width fonts, and small scripts written in shell, Python, or another language. A generator is convenient when you need quick lettering. A hand-edited file is usually preferable for a particular drawing whose spacing and characters need to remain stable.

Keep spacing and character encoding consistent

Text art relies on alignment. Use a monospaced terminal font, where characters occupy consistent-width cells, and avoid placing artwork in software that collapses repeated spaces. A proportional font, automatic line wrapping, or an editor’s formatting can shift parts of a drawing and make a straight edge look uneven.

ASCII characters are generally safe across modern Linux environments, but Unicode art has extra dependencies. The terminal needs an appropriate encoding, usually UTF-8, and a font that contains the characters. If a border made from box-drawing symbols appears as question marks or empty squares, check the file encoding, locale, and selected font. Commands such as locale can show the current locale settings; changing them may require logging in again or starting a new terminal session.

Line endings can also affect files moved between systems. A file created with Windows-style carriage-return and line-feed endings may show an extra character at the end of lines in some contexts. If a drawing looks misaligned after copying it, inspect the file with a text editor or a tool such as file, and convert line endings if needed. Do not assume every visual problem is caused by the drawing itself.

Use color carefully

Linux terminals commonly support color through ANSI escape sequences, which are control characters that change display attributes such as foreground color. A program may apply these sequences around text-art output, or a shell script can print them explicitly. For example, many shells can display red text with a sequence such as \033[31m and restore the default style with \033[0m, though quoting and escape handling depend on the command used.

Color is optional and should not be mixed into a file that needs to remain plain ASCII without considering the consequences. Escape sequences are not visible letters, but they are still part of the output stream. They can make copied text look odd in a basic editor, affect width calculations, or be printed literally by software that does not interpret terminal control codes. For portable banners, plain monochrome output is the simplest choice.

Consider accessibility as well. Color should not be the only way a message communicates meaning, and elaborate banners can push useful command output off screen. If a script is intended for others, keep decorative output brief and provide a way to disable it when appropriate.

Common problems and practical fixes

When terminal art does not look right, first distinguish a layout issue from a missing tool. If the shell reports “command not found,” the generator is not installed or is not on the command search path. Install it through your distribution’s package manager, or use a plain text file instead. Avoid downloading and running an unfamiliar script just to print a banner.

  • Lines wrap unexpectedly: Make the terminal wider, shorten the text, or choose a narrower FIGlet font. Wrapping changes the apparent shape.
  • Characters appear as boxes: Check whether the drawing uses Unicode, and verify the terminal’s encoding and font. Replace unsupported symbols with basic ASCII if compatibility matters.
  • Parts do not line up: Use a monospaced font and preserve leading spaces. Check whether a chat application, web form, or editor has removed repeated spaces or tabs.
  • Backslashes or dollar signs change: In shell commands, quoting rules can treat these characters specially. A single-quoted here-document or a saved text file avoids many accidental expansions.
  • Output includes strange color codes: The text may contain terminal escape sequences being shown literally. Use plain-text output or a program that understands the sequences.

Safety when displaying terminal text

Ordinary letters and punctuation in an ASCII drawing are not executable commands merely because they appear in a terminal. The risk is different when a file contains control characters or escape sequences. Some terminal control codes can change colors or cursor position; other sequences may affect terminal features such as its title. Behavior varies by terminal, and terminals have added protections over time, but blindly displaying untrusted data is still a poor habit.

Be especially cautious with output copied from an unknown source or generated from untrusted input. A file can contain invisible control characters that are difficult to notice in a normal text viewer. If you only need to inspect a suspicious file, use a viewer or inspection tool that makes nonprinting characters visible rather than immediately sending its contents to the terminal. For scripts, validate user-supplied text and avoid treating it as shell code.

When ASCII art is useful—and when it is not

Text art suits environments where plain text is easy to store and display: command-line demonstrations, README files, comments, compact status messages, and retro-style decorations. It can also be useful over simple connections or in logs where attaching an image would be inconvenient. Its low technical requirements are part of its appeal.

It is a poor fit when the image must scale smoothly, convey fine detail, or look identical in every application. Terminals differ in font, cell size, window width, and control-sequence support. Use an image format for a logo that must preserve its design, or Unicode symbols when they serve the purpose and the target environment supports them. “ASCII art” is not a Linux-only feature: the same plain characters can be shown in many text environments, while Linux provides convenient tools for generating and displaying them.

Frequently Asked Questions

How do I show ASCII art in a Linux terminal?
Save the drawing in a text file and run cat filename, or print it with printf. For large lettering, install and run a generator such as FIGlet.

How do I install FIGlet on Linux?
Use your distribution’s package manager. On Debian and Ubuntu, a common command is sudo apt install figlet. Check your distribution’s documentation for its package name and installation command.

Is FIGlet already installed?
Not necessarily. Try figlet Hello; if the shell says the command is missing, install the package or use another method, such as displaying a saved text file.

Why does my ASCII art look misaligned?
Common causes include a proportional font, wrapped lines, tabs, altered spaces, or shell quoting that changed characters. Use a monospaced font, widen the terminal, and inspect the saved text.

Can I use Unicode symbols in ASCII art?
You can use them in terminal text art, but the result is not strictly ASCII. Unicode symbols may require UTF-8 and a font with the right glyphs, so basic ASCII is more portable.

Is cowsay an ASCII-art program?
It prints text alongside a character drawing made from terminal characters, so it is commonly grouped with ASCII-art tools. Its main purpose is a speech-bubble effect, not general image creation.

ASCII Art in the Linux Terminal: How to Make It
Scroll to top